sqlite not using index with like query

前端 未结 4 1907
别那么骄傲
别那么骄傲 2021-02-19 10:27

Ive been trying to get sqlite to use an index with a like to no avail. Ive tried collate nocase and still no luck. Anyone have any ideas on how to get sqlite to do a like hittin

4条回答
  •  迷失自我
    2021-02-19 11:03

    Quote from sqlite mail list (http://www.mail-archive.com/sqlite-users@sqlite.org/msg27760.html)

    LIKE is case-insensitive by default. To have it use your index, you need to either make the index case-insensitive:

    CREATE INDEX test_name ON test (name COLLATE NOCASE);

    or make LIKE case-sensitive:

    PRAGMA case_sensitive_like = 1;

提交回复
热议问题