What I want to do
Optimize performance of both equality checking and sorting.
What I did
Indexed the same string predicate with both hash and exact.
Question
String predicates offer several indexes. The docs say:
The most performant index for
eqishash.
About the exact index the docs say:
Allows faster sorting.
Based on this I’ve been using hash and exact where I want fast sorting + optimal equality checking.
type Event {
Event.type
}
Event.type: string @index(hash, exact) .
The 2 indexes seem to have different characteristics. If I pull a list of nodes for a table, I’d like to have them sort efficiently, especially for a long list where I’ll have to pull many pages (exact). If I’m doing many queries that check a precise string, I’d like them to be as fast as possible (hash).
Ratel complains about this, saying it’s a bad pattern. It won’t even let you save with both of them:
‘exact’ and ‘hash’ index types shouldn’t be used together
Is this right? I was surprised to see a blanket prohibition. Does it make sense to use them together? Will hash even be used for equality checking if there’s also an exact index?