Another possibility... INSERT the keys in a temporary table and do an 
appropriate JOIN.Sent from my Samsung Galaxy S7 - powered by Three
-------- Original message --------From: Simon Slavin <slav...@bigfraud.org> 
Date: 13/09/2019  17:51  (GMT+00:00) To: SQLite mailing list 
<sqlite-users@mailinglists.sqlite.org> Subject: Re: [sqlite] Fastest way to 
SELECT on a set of keys? On 13 Sep 2019, at 5:38pm, Jens Alfke 
<j...@mooseyard.com> wrote:> Does anyone have intuition or actual knowledge 
about which approach is better? Or know of a 3rd better approach?My guess is 
(b), but it will depend on your particular setup.  Depends on cache size, 
storage speed, whether your OS is real or virtualized, etc..  I don't think the 
overhead of preparation will cause much of a delay.Solution (b) will require 
more memory than (a) since it has to keep the array of all keys in memory until 
the command is finished.There is, of course, solution (c): read every row and 
check in your software whether it has one of the keys you want.  This requires 
preparing and executing one statement.  If your list of keys covers most of the 
rows this may be fastest.  And it uses the least 
memory._______________________________________________sqlite-users mailing 
listsqlite-users@mailinglists.sqlite.orghttp://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to