electric
electric copied to clipboard
Index IN statements in where clauses
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.