search

Home  >  Q&A  >  body text

mysql optimization - Will the mysql like statement cause a full table scan?

select id from t where name like '%abc%'

習慣沉默習慣沉默2746 days ago1082

reply all(3)I'll reply

  • 滿天的星座

    滿天的星座2017-05-24 11:36:37

    Fuzzy query, even if you have an index, you don’t know whether there are these three letters in the index or whether they are arranged in this position or in this row. . .

    reply
    0
  • 黄舟

    黄舟2017-05-24 11:36:37

    Not necessarily depends on the query conditions.
    If it matches the left prefix, you can use the index
    For example like abc%

    reply
    0
  • 黄舟

    黄舟2017-05-24 11:36:37

    Same as above, try not to blur like in sql. If the amount of data is large, it will be messed up.

    reply
    0
  • Cancelreply