mysql索引规则

时间:2014-08-24 19:29:23   收藏:0   阅读:216

mysql建索引最好在整数字段上,效果较明显

===>1.select * from goods where is_delete=0 and status=1 and (name like ‘%%‘ or intro like ‘%%‘)

2.如果在is_delete 和status上建索引 ,速度差距至少有几十倍

3.索引建在整数上比char  varchar上快

4.关联查询时,最好关联的字段类型都是一样,最好是int,因为为varchar时需要设计类型转换,也需要消耗io 

     记:一次做搜索查询

本文出自 “Linux运维” 博客,请务必保留此出处http://2853725.blog.51cto.com/2843725/1544159

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!