[query] Allow later constraints to affect earlier patterns' table choices #151
Labels
No labels
A-build
A-cli
A-core
A-design
A-edn
A-ffi
A-query
A-sdk
A-sdk-android
A-sdk-ios
A-sync
A-transact
A-views
A-vocab
P-Android
P-desktop
P-iOS
bug
correctness
dependencies
dev-ergonomics
discussion
documentation
duplicate
enhancement
enquiry
good first bug
good first issue
help wanted
hygiene
in progress
invalid
question
ready
size
speed
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: greg/mentat#151
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
We naïvely alias tables as patterns are processed: as soon as we see
we decide to query
all_datoms
, because the attribute is unknown, and we alias that to something likeall_datoms00
.This is expedient: we can process a collection of patterns mutably, one by one, and at the end be almost ready to produce SQL.
However, if the next pattern is:
we know that for this CC to produce results
?y
must be numeric. Armed with that knowledge, we know we can usedatoms
instead ofall_datoms
, which will yield a more efficient query.As noted in https://github.com/mozilla/mentat/pull/374#issuecomment-288278950, in order to do this we need to do one of three things:
?y
is numeric because both arms of a nestedor-join
are numeric. That gets a little complicated if we wish to do this right.