'LIKE ('%this%' OR '%that%') and something=else' not working

前端 未结 7 1401
南方客
南方客 2020-12-15 14:53

I have a select query where I am trying to search strings for multiple patterns

LIKE (\'%this%\' or \'%that%\' ) and something=else

Returns

7条回答
  •  情书的邮戳
    2020-12-15 15:41

    I know it's a bit old question but still people try to find efficient solution so instead you should use FULLTEXT index (it's available from MySQL 5.6.4).

    Query on table with +35mil records by triple like in where block took ~2.5s but after adding index on these fields and using BOOLEAN MODE inside match ... against ... it took only 0.05s.

提交回复
热议问题