3 ms·
Deterministic semantics are something I approve of. I'd rather have indexes under my control than the DB's. Is it one index per chained operation (filter with
by JulianMorrison 13y ago
Deterministic semantics are something I approve of. I'd rather have indexes under my control than the DB's.
Is it one index per chained operation (filter with index A then join with index B, for example)? Or can you only use one index per complete query?
- jdoliner 13y agoYou can use multiple indexes in some queries. The case you described will work. However you can't use multiple indexes from the same table. For example: table.between(...).between(...) won't work. You'd have to use a filter (and thus a linear scan to do the second between. This seems like it would be a good thing for us to add to the FAQ because the rules on it can be a bit complicated. However the best way to find out might actually just be to try. Because we're not using an optimizer in the background you have to explicitly say which indexes you're using and thus they system will just refuse to do queries if it can't use indexes the way you're asking it to.
- coffeemug 13y agoYou can't currently do index intersection (so you can't chain `between` commands), but you can absolutely use multiple indexes with joins. E.g. `table.between(...).eq_join(...).eq_join(...)` will use three indexes in this example. EDIT: err, Joe beat me to it.