zoukankan      html  css  js  c++  java
  • 造成索引失效的情况

      创建索引:create index idx_xxx on table(column);

      分析索引使用情况用explain关键字

      失效情况:

      1.like模糊查询%开头(优化:%放后面或者使用覆盖索引)

      2.使用or关键字,必须or左右全部使用索引

      3.索引列进行运算(+,-,*,/)

      4.索引列使用函数

      5.单独引用联合索引非第一位置的索引列(最左匹配原则)

      6.索引字段使用表否定(!=或者<>,not in)

      7.索引字段使用is null,is not null

      9.左连接或右连接查询,关联字段编码不一致

      10.索引字段是字符串,查询时需要用引号括起来

      引用某大佬一篇说的很好的文章:https://mp.weixin.qq.com/s/AsfRjsmp3unc941BRS_4zw

      

      

      

      

  • 相关阅读:
    Rotate Image
    Color Sort
    Chapter 3: Binary Tree
    Different Ways to Add Parentheses
    最短路径问题
    Longest Palindromic Substring
    Word Break
    PCA和SVD简述
    Set Matrix Zeros
    星级评价
  • 原文地址:https://www.cnblogs.com/coderxiaobai/p/12881165.html
Copyright © 2011-2022 走看看