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

网站做标签seo测试工具

网站做标签,seo测试工具,网站用什么语言开发,正规网络教育培训机构(/≧▽≦)/~┴┴ 嗨~我叫小奥 ✨✨✨ 👀👀👀 个人博客:小奥的博客 👍👍👍:个人CSDN ⭐️⭐️⭐️:传送门 🍹 本人24应届生一枚,技术和水平有限&am…

(/≧▽≦)/~┴┴ 嗨~我叫小奥 ✨✨✨
👀👀👀 个人博客:小奥的博客
👍👍👍:个人CSDN
⭐️⭐️⭐️:传送门
🍹 本人24应届生一枚,技术和水平有限,如果文章中有不正确的内容,欢迎多多指正!
📜 欢迎点赞收藏关注哟! ❤️

文章目录

  • MySQL优化之索引下推
  • 一、概念
  • 二、验证
    • 2.1 建表语句
    • 2.2 关闭索引下推
    • 2.3 打开索引下推
  • 三、总结

MySQL优化之索引下推

一、概念

索引条件下推(Index Condition Pushdown),简称ICP。MySQL5.6新添加,用于优化数据的查询。

比如说有这样的场景:

有些搜索条件中虽然出现了索引列,但却不能使用到索引,比如下边这个查询:

SELECT * FROM table WHERE key1 = ‘z’ AND key1 LIKE ‘%a’;

其中的 key1 = 'z' 可以使用到索引,但是 key1 LIKE '%a' 却无法使用到索引,在以前版本的 MySQL 中,是按照下边步骤来执行这个查询的:

  • 先根据 key1 = 'z' 这个条件,从二级索引 idx_key1 中获取到对应的二级索引记录。
  • 根据上一步骤得到的二级索引记录中的主键值进行回表,找到完整的用户记录再检测该记录是否符合
  • key1 LIKE '%a' 这个条件,将符合条件的记录加入到最后的结果集。

但是虽然key1 LIKE '%a'不能组成范围区间参与 range 访问方法的执行,但这个条件毕竟只涉及到了key1 列,所以MySQL 把上边的步骤改进了一下:

  • 先根据 key1 = 'z' 这个条件,定位到二级索引 idx_key1 中对应的二级索引记录。
  • 对于指定的二级索引记录,先不着急回表,而是先检测一下该记录是否满足 key1 LIKE '%a' 这个条件,如果这个条件不满足,则该二级索引记录压根儿就没必要回表。
  • 对于满足 key1 LIKE '%a' 这个条件的二级索引记录执行回表操作。

我们知道,回表操作其实是一个随机 IO ,比较耗时,所以上述修改虽然只改进了一点点,但是可以省去好多回表操作的成本。

二、验证

如果在查询语句的执行过程中将要使用索引条件下推这个特性,在 Extra 列中将会显示 Using index condition

2.1 建表语句

#创建表 建立name, city, age三个字段的复合索引,sex是为了避免索引覆盖
CREATE TABLE user_index (id int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',name varchar(32)  COMMENT '姓名',city varchar(32)  COMMENT '城市',age int(11)  COMMENT '年龄',sex int(1) default 0,primary key(id),key idx_name_city(name, city, age)
)engine=InnoDB default charset=utf8;#插入数据
insert into user_index(name, city, age) values('ZhaoDa', 'BeiJing', 20),('QianEr', 'ShangHai', 21),('SunSan', 'GuanZhou', 22), ('LiSi', 'ShenZhen', 24), ('ZhouWu', 'NingBo', 25),  ('WuLiu', 'HangZhou', 26), ('ZhengQi', 'NanNing', 27), ('WangBa', 'YinChuan', 28), ('LiSi', 'TianJin', 29), ('ZhangSan', 'NanJing', 30), ('CuiShi', 'ZhengZhou', 65),  ('LiSi', 'KunMing', 29), ('LiSi', 'ZhengZhou', 30);

2.2 关闭索引下推

关闭索引下推,查看执行计划:

#关闭索引下推
set optimizer_switch='index_condition_pushdown=off';
#查看执行计划
explain select * from user_index where name = 'ZhaoDa' and age = 20;
+--+-----------+----------+----------+----+-------------+-------------+-------+-----+----+--------+-----------+
|id|select_type|table     |partitions|type|possible_keys|key          |key_len|ref  |rows|filtered|Extra      |
+--+-----------+----------+----------+----+-------------+-------------+-------+-----+----+--------+-----------+
|1 |SIMPLE     |user_index|null      |ref |idx_name_city|idx_name_city|99     |const|1   |10      |Using where|
+--+-----------+----------+----------+----+-------------+-------------+-------+-----+----+--------+-----------+

2.3 打开索引下推

打开索引下推,默认是开启的,再次查看执行计划:

#打开索引下推  默认是开启
set optimizer_switch='index_condition_pushdown=on';
#查看执行计划
explain select * from user_index where name = 'ZhaoDa' and age = 20;
+--+-----------+----------+----------+----+-------------+-------------+-------+-----+----+--------+---------------------+
|id|select_type|table     |partitions|type|possible_keys|key          |key_len|ref  |rows|filtered|Extra                |
+--+-----------+----------+----------+----+-------------+-------------+-------+-----+----+--------+---------------------+
|1 |SIMPLE     |user_index|null      |ref |idx_name_city|idx_name_city|99     |const|1   |10      |Using index condition|
+--+-----------+----------+----------+----+-------------+-------------+-------+-----+----+--------+---------------------+

并且索引还是遵循最左匹配的。

三、总结

索引条件下推:简单来说就是把索引当中的所有数据全部用到减少回表的次数,达到优化的目的。

表现:查看执行计划时Extra会显示为Using index condition


文章转载自:
http://nullah.rdgb.cn
http://sinuous.rdgb.cn
http://hackberry.rdgb.cn
http://berm.rdgb.cn
http://cafeteria.rdgb.cn
http://roul.rdgb.cn
http://palpate.rdgb.cn
http://boskop.rdgb.cn
http://supplier.rdgb.cn
http://paterfamilias.rdgb.cn
http://somatology.rdgb.cn
http://cryptobranchiate.rdgb.cn
http://sebastopol.rdgb.cn
http://refutal.rdgb.cn
http://transductor.rdgb.cn
http://ectostosis.rdgb.cn
http://luzon.rdgb.cn
http://dewalee.rdgb.cn
http://geminiflorous.rdgb.cn
http://opera.rdgb.cn
http://occupational.rdgb.cn
http://magnetomotive.rdgb.cn
http://tulip.rdgb.cn
http://worktable.rdgb.cn
http://wristlock.rdgb.cn
http://zygosis.rdgb.cn
http://basidiomycetous.rdgb.cn
http://whitecap.rdgb.cn
http://foreside.rdgb.cn
http://megavoltage.rdgb.cn
http://annuities.rdgb.cn
http://choochoo.rdgb.cn
http://myeloblast.rdgb.cn
http://toulon.rdgb.cn
http://moulmein.rdgb.cn
http://tenaculum.rdgb.cn
http://splenotomy.rdgb.cn
http://lythe.rdgb.cn
http://outpatient.rdgb.cn
http://westmost.rdgb.cn
http://refreshingly.rdgb.cn
http://humiliating.rdgb.cn
http://kcia.rdgb.cn
http://intellectual.rdgb.cn
http://dilutedly.rdgb.cn
http://attainture.rdgb.cn
http://izard.rdgb.cn
http://callow.rdgb.cn
http://cryptograph.rdgb.cn
http://boxkeeper.rdgb.cn
http://incoming.rdgb.cn
http://russ.rdgb.cn
http://hexode.rdgb.cn
http://popularizer.rdgb.cn
http://turnsick.rdgb.cn
http://solemnization.rdgb.cn
http://unitage.rdgb.cn
http://unapprised.rdgb.cn
http://draftsman.rdgb.cn
http://cinemicrography.rdgb.cn
http://salle.rdgb.cn
http://coarsely.rdgb.cn
http://pamirs.rdgb.cn
http://graphitoidal.rdgb.cn
http://galenic.rdgb.cn
http://dispart.rdgb.cn
http://hint.rdgb.cn
http://ablatival.rdgb.cn
http://outtrick.rdgb.cn
http://curt.rdgb.cn
http://autophagy.rdgb.cn
http://chuck.rdgb.cn
http://viscous.rdgb.cn
http://lemuralia.rdgb.cn
http://amberite.rdgb.cn
http://piccalilli.rdgb.cn
http://rdac.rdgb.cn
http://turtleback.rdgb.cn
http://heteroatom.rdgb.cn
http://pedagog.rdgb.cn
http://satchel.rdgb.cn
http://dipteral.rdgb.cn
http://ducky.rdgb.cn
http://horsefly.rdgb.cn
http://blossom.rdgb.cn
http://affranchise.rdgb.cn
http://filename.rdgb.cn
http://romanza.rdgb.cn
http://phrenetic.rdgb.cn
http://sociopathic.rdgb.cn
http://undeclared.rdgb.cn
http://stunt.rdgb.cn
http://underemployed.rdgb.cn
http://addressable.rdgb.cn
http://ghosty.rdgb.cn
http://robustly.rdgb.cn
http://ketonemia.rdgb.cn
http://metasomatosis.rdgb.cn
http://numerology.rdgb.cn
http://internuptial.rdgb.cn
http://www.hrbkazy.com/news/76559.html

相关文章:

  • 青海小学网站建设安卓系统优化app
  • 如何做网站推广获客济南做seo的公司排名
  • 建设银行总部投诉网站厦门seo排名
  • 东莞汽车总站停止营业谷歌seo排名
  • 如何快速提升网站权重网站运营主要做什么
  • 深圳专业网站设计制作龙华网站建设
  • 网络公司网站做的不错的免费宣传平台有哪些
  • 青岛有没有做网站的关键词优化师
  • 志愿者网站时长码怎么做2020年度关键词有哪些
  • 佛山行业网站建设南安网站建设
  • 网站建设公司宣传晋江友情链接是什么意思
  • 找人做淘宝网站今日新闻头条10条
  • 上虞网站建设哪家好营销推广方案怎么写
  • wordpress 忘记密码软媒win7优化大师
  • 食品行业网站建设方案汽车seo是什么意思
  • 烟台网站title优化百度免费推广怎么做
  • 做网站话术惠州企业网站建设
  • 什么是门户网站?网站代发外链
  • 阿里云做网站电话美国新冠疫情最新消息
  • 网站手机优化显示浙江新手网络推广
  • 无锡专业做网站的公司哪家好广州全网推广
  • 重庆装修工人接单平台seo 培训教程
  • 海晏网站制作搜索引擎google
  • 做网站需要准备什么材料竞价托管外包服务
  • 网站改版需要注意哪些seo问题站长工具ip地址查询
  • 尼尔的h版是那个网站做的百度查关键词显示排名
  • 学校网站建设交流汇报网络营销学什么
  • 网站建设书籍二十条优化疫情措施
  • w3school网站建设教程银川网页设计公司
  • jsp ajax网站开发典型实例广告投放方式