当前位置: 首页 > news >正文

做的网站怎才能被别人访问到建网站做代理ip

做的网站怎才能被别人访问到,建网站做代理ip,怎么做网站页面模板,一个ip做网站MySQL中的联合索引(也叫组合索引)遵循最左匹配原则#xff0c;即在创建联合索引时#xff0c;查询条件必须从索引的最左边开始#xff0c;否则索引不会被使用。在联合索引的情况下#xff0c;数据是按照索引第一列排序#xff0c;第一列数据相同时才会按照第二列排序。 例…MySQL中的联合索引(也叫组合索引)遵循最左匹配原则即在创建联合索引时查询条件必须从索引的最左边开始否则索引不会被使用。在联合索引的情况下数据是按照索引第一列排序第一列数据相同时才会按照第二列排序。 例如假设有一个表t_employees它有一个联合索引(first_name, last_name)。 (root192.168.80.85)[superdb] create table t_employees as select EMPLOYEE_ID,FIRST_NAME,LAST_NAME,SALARY from employees; Query OK, 91 rows affected (0.06 sec) Records: 91 Duplicates: 0 Warnings: 0(root192.168.80.85)[superdb] select * from t_employees; ------------------------------------------------- | EMPLOYEE_ID | FIRST_NAME | LAST_NAME | SALARY | ------------------------------------------------- | 116 | Shelli | Baida | 2900.00 | | 117 | Sigal | Tobias | 2800.00 | | 118 | Guy | Himuro | 2600.00 | | 119 | Karen | Colmenares | 2500.00 | | 120 | Matthew | Weiss | 8000.00 | | 121 | Adam | Fripp | 8200.00 | | 122 | Payam | Kaufling | 7900.00 | | 123 | Shanta | Vollman | 6500.00 | | 124 | Kevin | Mourgos | 5800.00 | | 125 | Julia | Nayer | 3200.00 | | 126 | Irene | Mikkilineni | 2700.00 | | 127 | James | Landry | 2400.00 | | 128 | Steven | Markle | 2200.00 | | 129 | Laura | Bissot | 3300.00 | | 130 | Mozhe | Atkinson | 2800.00 | | 131 | James | Marlow | 2500.00 | | 132 | TJ | Olson | 2100.00 | | 133 | Jason | Mallin | 3300.00 | | 134 | Michael | Rogers | 2900.00 | | 135 | Ki | Gee | 2400.00 | | 136 | Hazel | Philtanker | 2200.00 | | 137 | Renske | Ladwig | 3600.00 | | 138 | Stephen | Stiles | 3200.00 | | 139 | John | Seo | 2700.00 | | 140 | Joshua | Patel | 2500.00 | | 141 | Trenna | Rajs | 3500.00 | | 142 | Curtis | Davies | 3100.00 | | 143 | Randall | Matos | 2600.00 | | 144 | Peter | Vargas | 2500.00 |(root192.168.80.85)[superdb] alter table t_employees add constraint pk_t_employees_id primary key(EMPLOYEE_ID); Query OK, 0 rows affected (0.10 sec) Records: 0 Duplicates: 0 Warnings: 0(root192.168.80.85)[superdb] create index indx_t_employees_nameinfo on t_employees(FIRST_NAME,LAST_NAME); Query OK, 0 rows affected (0.14 sec) Records: 0 Duplicates: 0 Warnings: 0(root192.168.80.85)[superdb] show index from t_employees; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Visible | Expression | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | t_employees | 0 | PRIMARY | 1 | EMPLOYEE_ID | A | 91 | NULL | NULL | | BTREE | | | YES | NULL | | t_employees | 1 | indx_t_employees_nameinfo | 1 | FIRST_NAME | A | 79 | NULL | NULL | YES | BTREE | | | YES | NULL | | t_employees | 1 | indx_t_employees_nameinfo | 2 | LAST_NAME | A | 91 | NULL | NULL | | BTREE | | | YES | NULL | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3 rows in set (0.01 sec) 1、满足联合索引最左匹配原则 以下查询会使用这个联合索引 SELECT * FROM t_employees WHERE first_name ‘James’; SELECT * FROM t_employees WHERE first_name ‘James’ AND last_name ‘Marlow’; (root192.168.80.85)[superdb] explain SELECT * FROM t_employees WHERE first_name James; --------------------------------------------------------------------------------------------------------------------------------------------- | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | --------------------------------------------------------------------------------------------------------------------------------------------- | 1 | SIMPLE | t_employees | NULL | ref | indx_t_employees_nameinfo | indx_t_employees_nameinfo | 83 | const | 2 | 100.00 | NULL | --------------------------------------------------------------------------------------------------------------------------------------------- 1 row in set, 1 warning (0.00 sec)(root192.168.80.85)[superdb] explain SELECT * FROM t_employees WHERE first_name James and LAST_NAMEMarlow; --------------------------------------------------------------------------------------------------------------------------------------------------- | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | --------------------------------------------------------------------------------------------------------------------------------------------------- | 1 | SIMPLE | t_employees | NULL | ref | indx_t_employees_nameinfo | indx_t_employees_nameinfo | 185 | const,const | 1 | 100.00 | NULL | --------------------------------------------------------------------------------------------------------------------------------------------------- 1 row in set, 1 warning (0.01 sec) 但是下面的查询不会使用联合索引 SELECT * FROM t_employees WHERE LAST_NAME‘Marlow’; (root192.168.80.85)[superdb] explain SELECT * FROM t_employees WHERE LAST_NAMEMarlow; ----------------------------------------------------------------------------------------------------------------- | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | ----------------------------------------------------------------------------------------------------------------- | 1 | SIMPLE | t_employees | NULL | ALL | NULL | NULL | NULL | NULL | 91 | 10.00 | Using where | ----------------------------------------------------------------------------------------------------------------- 1 row in set, 1 warning (0.01 sec) 因为它们没有从索引的最左边开始。在联合索引的情况下数据是按照索引第一列排序第一列数据相同时才会按照第二列排序。 下面的查询会使用联合索引 (root192.168.80.85)[superdb] explain SELECT * FROM t_employees WHERE LAST_NAMEMarlow and first_name James; --------------------------------------------------------------------------------------------------------------------------------------------------- | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | --------------------------------------------------------------------------------------------------------------------------------------------------- | 1 | SIMPLE | t_employees | NULL | ref | indx_t_employees_nameinfo | indx_t_employees_nameinfo | 185 | const,const | 1 | 100.00 | NULL | --------------------------------------------------------------------------------------------------------------------------------------------------- 1 row in set, 1 warning (0.00 sec) 联合索引要能正确使用需要遵循最左匹配原则也就是按照最左优先的方式进行索引的匹配。需要注意的是因为有查询优化器所以 first_name,last_name 字段在 where 子句的顺序并不重要 2、联合索引不遵循最左匹配原则也是走全扫描二级索引树 我们都知道联合索引要遵循最左匹配才能走索引但是如果数据库表中的字段都是索引的话即使查询过程中没有遵循最左匹配原则也是走全扫描二级索引树(typeindex) 如下的表结构及查询 (root192.168.80.85)[superdb] create table t_emplist as select EMPLOYEE_ID,FIRST_NAME,LAST_NAME from employees; Query OK, 91 rows affected (0.10 sec) Records: 91 Duplicates: 0 Warnings: 0(root192.168.80.85)[superdb] alter table t_emplist add constraint pk_t_emplist_id primary key(EMPLOYEE_ID); Query OK, 0 rows affected (0.11 sec) Records: 0 Duplicates: 0 Warnings: 0(root192.168.80.85)[superdb] create index indx_t_emplist_nameinfo on t_emplist(FIRST_NAME,LAST_NAME); Query OK, 0 rows affected (0.05 sec) Records: 0 Duplicates: 0 Warnings: 0 如下面的查询会使用联合索引但不是最左匹配原则 SELECT * FROM t_emplist WHERE LAST_NAME‘Marlow’; (root192.168.80.85)[superdb] explain SELECT * FROM t_emplist WHERE LAST_NAMEMarlow; ---------------------------------------------------------------------------------------------------------------------------------------------------------- | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | 1 | SIMPLE | t_emplist | NULL | index | indx_t_emplist_nameinfo | indx_t_emplist_nameinfo | 185 | NULL | 91 | 10.00 | Using where; Using index | ---------------------------------------------------------------------------------------------------------------------------------------------------------- 1 row in set, 1 warning (0.01 sec) 如果数据库表中的字段只有主键二级索引那么即使查询的where条件不满足最左匹配原则也不会走全表扫描typeall而是走全扫描二级索引树(typeindex)。 关键还是看数据表中的字段及索引情况。
http://www.lakalapos1.cn/news/24214/

相关文章:

  • 上海全国网站建设中国有名的网站建设公司
  • 网站哪里有做的低价格制作网站
  • wordpress树形导航网络seo首页
  • 手机网站设计公司有哪些公司网站建设具体实施方案
  • 如何做电子商务网站简述网站与网页的区别
  • 陶瓷行业网站建设招标书金华网站建设工程网站建设
  • 用asp做宠物网站页面js调用wordpress文章列表
  • 网站开发建设方案两人世界高清完整版免费观看
  • 微网站管理平台房地产公司排名前十
  • 抚顺市+网站建设网站alt标签
  • 网站建设重要性秦皇岛市建设局网站关于装配式专家
  • 金湖县城乡建设局网站在线观看网址最新电影
  • jsp网站建设毕业设计中信建设证券网站
  • 凉山州住房和城乡建设厅网站现在做网站建设挣钱吗
  • 建设网站需要的开发工具房地产设计网站
  • 网站分析实例网站seo排名查询
  • seo营销网站wordpress怎么删除主题
  • 网站开发大概需要多少钱石家庄酒店网站建设
  • 青岛城乡建设局网站首页织梦做的网站图片路径在哪里
  • 有免费的网站做农家院宣传wordpress 文章列表顺序
  • 上海网站建设治汇网络手工活接单app
  • 专业建设网站公司排名注册100万公司每年费用多少
  • 网站开发汇报ppt西安小程序制作
  • 上海市建设安全协会网站特种工正规网站建设公司多少钱
  • 网站设计分工WordPress博客互相采集
  • 网站风格代码跨境电商怎么做无货源模式
  • 了解网站建设规划流程西宁招聘网站开发
  • 网站平台方案南京网站建设电话
  • 校园网站的建设作用遵义网站建设厂家
  • 如何管理个人网站企业网站如何去做优化