Conversation
Contributor
|
View Vercel preview at instant-www-js-stop-using-index-jsv.vercel.app. |
dwwoelfel
commented
Jul 7, 2025
| (testing "join conditions matches values to coerced entities" | ||
| (is (= '(([:= :value [:to_jsonb :match-0-entity-id]])) | ||
| (raw-pats->join-conds '[[:ea ?a] [:eav _ _ ?a]])))) | ||
| (testing "join conditions matches values to coerced attrs" |
Contributor
Author
There was a problem hiding this comment.
I removed the test cases where we compare on attr ids because we never actually compare attr ids to anything.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1326 and prerequisite for #1330
Modifies some of the datalog queries to replace usage of the
vae_indexwith the newvae_uuid_index. Once we're no longer using thevae_indexat all, we can drop it and save ourselves some disk space and cpu on the db instance.Three main changes:
:vaeindex over the:avindex in attr-pat when both are applicable (i.e. querying a unique ref attr). This saves us converting an entity_id to JSON in a lot of cases--we can just directly compare the entity_id tojson_uuid_to_uuid(value), which requires no calculation because it's already in thevae_uuid_index.json_uuid_to_uuid(value) = entity_idinstead ofvalue = to_jsonb(entity_id)for better use of the vae index.in-or-eqto use[:json_uuid_to_uuid :value]when it encounters thevaeindex, instead of using[:to_jsonb :value]The structure of the symbol map changed. Instead of being a two-element array, it's now a map with some extra details.
[0 1]=>{:pattern-idx 0 :triples-idx 1, :ctype :a}. I did that so we could pass down whether the value was a ref into the join cols. It also has the benefit of making it easier to write thejoin-cond-for-or. Theors need to fully qualify theMinor changes:
:value-uuidand makes the code a bit cleaner.:match-0-prefix with just:m. It makes the queries easier to read and it's less data to and from the db.Did a backtest and didn't find any queries that got faster or slower.