-
Notifications
You must be signed in to change notification settings - Fork 109
Indexes don't handle negation correctly #262
Comments
As discussed via slack with @mcarmonaa, another part of the bug is the fact that when a |
There are different involved things here as discussed in slack:
type Negate interface {
Not(...IndexLookup) IndexLookup
}
or as
the index won't be used in a simple query like
Right now the rule to assign indexes only manage Because of the third point, I couldn't find a case where the query triggers the use of some index getting no rows as result. @ajnavarro @erizocosmico Have I missed or misunderstood something? |
1- the correct Negate interface would be: type Negate interface {
Not() IndexLookup
} 2- Index created as 3- Yep, appears to be working correctly right now:
|
Because
FOO != 1
gets translated toNOT (FOO = 1)
, we can useFOO = 1
in the index. Afterwards, the conditionNOT (FOO = 1)
is evaluated. Because it is false, the result will be 0 rows.Therefore, all queries using an index and
!=
orNOT IN
will have 0 results.The text was updated successfully, but these errors were encountered: