electric icon indicating copy to clipboard operation
electric copied to clipboard

Index IN statements in where clauses

Open balegas opened this issue 10 months ago • 1 comments

We've optimised handling of arrays and in where clauses. IN clauses can reuse this work.

balegas avatar Feb 25 '25 10:02 balegas

To optimise field IN (a,b,c) we would create a GIN (Generalized Inverted Index) like we do in the EqualityIndex.

So shapes:

  • s1, where: field in (1,2,3)
  • s2, where: field in (2,3,4)

becomes a map from values to shape:

{
    1: [s1],
    2: [s1,s2],
    3: [s1,s2],
    4: [s2]
}

And if a change comes in with field: 2 we quickly see this affects s1 & s2.

robacourt avatar Feb 26 '25 11:02 robacourt