码迷,mamicode.com
首页 > 其他好文 > 详细

主键查询值,int与字符串类型混用导致索引失效

时间:2017-02-14 11:49:09      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:索引   rom   simple   primary   extra   null   类型   字符串   ref   

select * from user where id in (5230,’45’)

*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: user
         type: ALL
possible_keys: PRIMARY
          key: NULL
      key_len: NULL
          ref: NULL
         rows: 501591
        Extra: Using where
#不同类型进行比较时,同样会导致索引失效,存在隐时类型转换

主键查询值,int与字符串类型混用导致索引失效

标签:索引   rom   simple   primary   extra   null   类型   字符串   ref   

原文地址:http://www.cnblogs.com/HarveyBing/p/6396717.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!