[query] Exploit AVET and VAET indexes in query engine #274

Open
opened 2020-08-06 16:57:42 +00:00 by gburd · 0 comments
gburd commented 2020-08-06 16:57:42 +00:00 (Migrated from github.com)

The SQLite schema defining the datoms table (and the indexes upon it) specifies the AVET and VAET indexes as partial: see https://github.com/mozilla/mentat/blob/master/db/src/db.rs#L180-L181 and https://github.com/mozilla/mentat/blob/master/db/src/db.rs#L183-185. The only way the SQLite query engine can exploit those indexes is if the produced SQL constrains the query, in some way to have the relevant index_{avet,vaet} columns set -- and we don't do that right now.

There's a similar but technically distinct case that we do support. The :db/fulltext true case is managed as index_fulltext and as a separate table. If we wanted to, we could manage the partial indexes as separate tables manually. It's not clear what is the more desirable SQLite schema.

The SQLite schema defining the datoms table (and the indexes upon it) specifies the AVET and VAET indexes as partial: see https://github.com/mozilla/mentat/blob/master/db/src/db.rs#L180-L181 and https://github.com/mozilla/mentat/blob/master/db/src/db.rs#L183-185. The only way the SQLite query engine can exploit those indexes is if the produced SQL constrains the query, in some way to have the relevant `index_{avet,vaet}` columns set -- and we don't do that right now. There's a similar but technically distinct case that we do support. The `:db/fulltext true` case is managed as [`index_fulltext`](https://github.com/mozilla/mentat/blob/master/db/src/db.rs#L187-L196) and as a [separate table](https://github.com/mozilla/mentat/blob/master/db/src/db.rs#L209-L210). If we wanted to, we could manage the partial indexes as separate tables manually. It's not clear what is the more desirable SQLite schema.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: greg/mentat#274
No description provided.