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
%') and (not firstname like 'jimmy%'); -- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: Keith Medcalf >Sent: Friday, 28 February, 2020 17:37 >To: 'SQLite mailing list' >Subject: RE: [sqlit

Re: [sqlite] Intersecting multiple queries

2020-02-28 Thread Keith Medcalf
select stuff from data where uuid in (select uuid from data where ... INTERSECT select uuid from data where ... INTERSECT select uuid from data where ... ); -- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original

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