Manual parameter substitution in sqlite3

Tim Chase python.list at
Thu Mar 2 06:59:01 EST 2017

On 2017-03-02 09:55, Christian Gollwitzer wrote:
> you could do it "the (theoretical) right way", which is using
> another table. Insert your keys into a table, maybe temporary one,
> and then do
> select * from mumble where key in (select key from keytable)
> In theory that should also be faster, but unless you have a
> thousand keys, there will be no noticeable difference.

It would depend on the frequency with which the same query is
issued.  Bulk inserts, followed by the query, followed by cleaning up
the data would almost certainly be slower.  Bulk inserting the data
and then issuing thousands of queries against it could prove much
faster (though as with all things performance-related, test, don't
guess). But if the set of criteria changes frequently, the overhead
of inserting/deleting the data will almost certainly swamp any
potential speed-up.


More information about the Python-list mailing list