Re: [sqlite] Intersecting multiple queries

2020-03-02 Thread Hamish Allan
Thanks Jens and everyone. I'll try the approach of compiling statements on the fly. Best wishes, Hamish On Sat, 29 Feb 2020 at 23:13, Jens Alfke wrote: > > > On Feb 28, 2020, at 11:49 PM, Hamish Allan wrote: > > > > Again, I may be making incorrect assumptions. > > Remember the old Knuth

Re: [sqlite] Intersecting multiple queries

2020-02-29 Thread Jens Alfke
> On Feb 28, 2020, at 11:49 PM, Hamish Allan wrote: > > Again, I may be making incorrect assumptions. Remember the old Knuth quote about the danger of premature optimization. What’s the size of your data set? Have you tried making a dummy database of the same size and experimenting with

Re: [sqlite] Intersecting multiple queries

2020-02-28 Thread Hamish Allan
On Sat, 29 Feb 2020 at 00:45, Keith Medcalf wrote: > > In other words, why would one want to do: > > select * from data where uuid in (select uuid from data where twit == 1 > INTERSECT select uuid from data where twat == 1 INTERSECT select uuid from > data where lastname like 'cricket%'

Re: [sqlite] Intersecting multiple queries

2020-02-28 Thread Simon Slavin
On 29 Feb 2020, at 12:45am, Keith Medcalf wrote: > select * from data where (...) AND (...) AND (...) ; SELECT uuid FROM Data WHERE filter LIKE ? OR filter LIKE ? OR filter LIKE ? OR filter LIKE ? … would probably be an efficient way to do it if you could construct your

Re: [sqlite] Intersecting multiple queries

2020-02-28 Thread Keith Medcalf
ays a lot about anticipated traffic volume. > >>-Original Message- >>From: sqlite-users On >>Behalf Of Hamish Allan >>Sent: Friday, 28 February, 2020 16:02 >>To: SQLite mailing list >>Subject: [sqlite] Intersecting multiple queries >> >>Hi

Re: [sqlite] Intersecting multiple queries

2020-02-28 Thread Keith Medcalf
nal Message- >From: sqlite-users On >Behalf Of Hamish Allan >Sent: Friday, 28 February, 2020 16:02 >To: SQLite mailing list >Subject: [sqlite] Intersecting multiple queries > >Hi, > >I am building a list of UUIDs from multiple queries of the form: > >SEL

Re: [sqlite] Intersecting multiple queries

2020-02-28 Thread Simon Slavin
On 28 Feb 2020, at 11:02pm, Hamish Allan wrote: > What I'm wondering is if there's a shortcut to avoid having to build the UUID > list in app code I would probably start by building a list of the search patterns then see what I could do with it: (pattern1,pattern2,pattern3) Would a Common

[sqlite] Intersecting multiple queries

2020-02-28 Thread Hamish Allan
Hi, I am building a list of UUIDs from multiple queries of the form: SELECT uuid FROM Data WHERE filter LIKE ? with a different bound parameter each time. In app-space code, I'm getting the results of these queries and intersecting them, so that the final list contains only UUIDs returned by