共计 919 个字符,预计需要花费 3 分钟才能阅读完成。
SE LECT MAX(lastclick) as lastclick F ROM `manhua_arctype` W HERE reid NOT IN (0,45) LIMIT 0,1
se lect a.typename,a.id,a.bookclickm f rom `manhua_arctype` a w here a.reid=’8′ and a.id<>’13587′ order by bookclickm d esc limit 0,10
Se lect a.id,a.typename,a.tuijian,a.typeimg,a.description,a.zuozhe,b.id as reid,b.typename as retypename,c.id as zuozheid F rom `manhua_arctype` a left join `manhua_arctype` b on(b.id=a.reid) left join `manhua_arctype` c on(c.typename=a.zuozhe) WHERE a.reid not in(0,45) and a.booksize<500000 order by a.bookclickm desc limit 0,7
像上面的两个查询语句,都是从 arctype 中获取内容,
现在用 navicat 设置的, 把 where 后面的字段单独设置索引了, 设置方式是
名 栏位 索引类型 索引方式 r
reidreid Normal BTREE
ID ID NORMAL BTREE
BOOKCLICKM BOOOKLICKM NORMAL BTREE
BOOKSIZE BOOKSIZE NORMAL BTREE
复制代码
这样设置对吗?
上一篇:英国公司都要 kyc 的吗?
下一篇:自己用 3600CPU 开了十几台小机。
not in 和 < 应该不走索引 LOC 是建政论坛
loverhoc 发表于 2022-9-10 23:07
not in 和 < 应该不走索引
那应该用什么?explain xxxxxxxx
看下怎么索引的就知道了自己看执行计划不就知道了
sdqu 发表于 2022-9-10 23:21
explain xxxxxxxx
看下怎么索引的就知道了
explain 然后后面的查询语句吗?explain 后面加上你的查询语句,能知道那些走了索引,那些是全表扫描,一点一点优化