Re: [sqlite] Fastest way to SELECT on a set of keys?

2019-09-13 Thread Doug
I blows me away that you are able to produce such things as this at the drop of a hat! Thanks for your insights and ingenuity and completeness! Doug > -Original Message- > From: sqlite-users > On Behalf Of Keith Medcalf > Sent: Friday, September 13, 2019 1:30 PM > To: SQLite mailing list

Re: [sqlite] Fastest way to SELECT on a set of keys?

2019-09-13 Thread Keith Medcalf
That depends greatly on the overhead you have for executing each select statement. So I wrote a little test that uses my customized apsw library from Python 3. It also works using the as-distributed sqlite3 wrapper (except for the carray interface, which requires my customized apsw to be able

Re: [sqlite] [EXTERNAL] Fastest way to SELECT on a set of keys?

2019-09-13 Thread Hick Gunter
WITH list (key) AS (VALUES (mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Jens Alfke Gesendet: Freitag, 13. September 2019 18:39 An: SQLite mailing list Betreff: [EXTERNAL] [sqlite] Fastest way to SELECT on a set of keys? If I have a set of primary keys (let's say a few hun

Re: [sqlite] Fastest way to SELECT on a set of keys?

2019-09-13 Thread Graham Holden
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 Date: 13/09/2019 17:51 (GMT+00:00) To: SQLite mailing list Subject: Re: [sqlite] Fastest way to SELEC

[sqlite] Documentation error in comment in carray.c

2019-09-13 Thread Jens Alfke
There's a mistake in the documentation block-comment at the start of carray.c: **sqlite3_bind_value(pStmt, i, aX, "carray", 0); The function should be sqlite3_bind_pointer. —Jens ___ sqlite-users mailing list sqlite-users@mailinglists.sqlit

Re: [sqlite] Fastest way to SELECT on a set of keys?

2019-09-13 Thread Richard Hipp
On 9/13/19, Jens Alfke wrote: > If I have a set of primary keys (let's say a few hundred) and need to fetch > data from the table rows with those keys, what's the fastest way to do so? > The options seem to be: > > (a) Execute "SELECT … FROM table WHERE key=?", once for each key. > (b) Execute "SE

Re: [sqlite] Fastest way to SELECT on a set of keys?

2019-09-13 Thread Jose Isaias Cabrera
Jens Alfke, on Friday, September 13, 2019 12:38 PM, wrote... > (a) Execute "SELECT … FROM table WHERE key=?", once for each key. > (b) Execute "SELECT key, … FROM table WHERE key IN (…)", including all of the > key strings. I have found that the ... IN ... has provided a much faster result than

Re: [sqlite] Fastest way to SELECT on a set of keys?

2019-09-13 Thread Simon Slavin
On 13 Sep 2019, at 5:38pm, Jens Alfke 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 virt

[sqlite] Fastest way to SELECT on a set of keys?

2019-09-13 Thread Jens Alfke
If I have a set of primary keys (let's say a few hundred) and need to fetch data from the table rows with those keys, what's the fastest way to do so? The options seem to be: (a) Execute "SELECT … FROM table WHERE key=?", once for each key. (b) Execute "SELECT key, … FROM table WHERE key IN (…)"