Skip to content Skip to sidebar Skip to footer

Python Sqlite3 Not Using Index With Like

I have a table with a single column, which I query in two ways: SELECT * FROM sequences WHERE seqs='blablabla' SELECT * FROM sequences WHERE seqs LIKE 'blablabla%' For these quer

Solution 1:

The documentation says:

If the right-hand side is a parameter that is bound to a string, then this optimization is only attempted if the prepared statement containing the expression was compiled with sqlite3_prepare_v2() or sqlite3_prepare16_v2(). The LIKE optimization is not attempted if the right-hand side is a parameter and the statement was prepared using sqlite3_prepare() or sqlite3_prepare16().

Old versions of the pysqlite module use sqlite3_prepare().

Post a Comment for "Python Sqlite3 Not Using Index With Like"