Repository navigation
perf(executor): GROUP BY over a BIND counts per input first under ids (#11) - #175
Open
MathiasVDA wants to merge 9 commits into
Open
MathiasVDA wants to merge 9 commits into
MathiasVDA wants to merge 9 commits into
Conversation
/ in BIND, filters and orders under --executor ids: a quotient of integers or decimals is the evaluator's (spareval::decimal_divide), of doubles a double, by zero an error. A decimal quotient that does not end within 18 fraction digits gives up to the evaluator.
…data-eu/tripletrail into claude/project-thread-n3oul3
…data-eu/tripletrail into claude/project-thread-n3oul3
…data-eu/tripletrail into claude/project-thread-n3oul3
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.
What and why
#11, the follow-up noted in #172: under
--executor ids, aGROUP BYover a computed key was slower than underspareval. One example isBIND(?q * 2 AS ?k) … GROUP BY ?k, which took 16 to 21 ms against 11 to 14 on 133k orders.The cause was in
count::rewrite, which tried the grouped counts before the eager grouping.sparevalthe grouped counts can't take aBIND. So the eager grouping (eager_group) answered the query: it counts the rows per distinct?q, then computes theBINDonce per value (100 values).BIND. So they answered first, computing the expression for each of the 133k rows before grouping.Now, under the id executor, a
Groupwhose input is aBIND(or aFILTERon one) tries the eager grouping first. That step already gives up when there are nearly as many inputs as rows, and then the grouped counts run as before. Undersparevalnothing changes.How it was tested
tests/id_rows.rsGROUPS has three new cases, each compared with the evaluator:?q * 2;SUMandMAXby?q - 3with a filter on it;COUNT(DISTINCT ?q / 2)per customer.Oracle with ids as the default: all suites pass, apart from the two known plan-shape assertions in
bind_keyed_lookup.133k orders, result cache off, three runs, same answers:
BIND(?q * 2 AS ?k) … GROUP BY ?kBIND(ABS(?q) AS ?k) … GROUP BY ?kSUM(?q * 2)per customer, top 5 (many inputs, unchanged)cargo fmt --checkandcargo clippy -p tripletrail --all-targets -D warningspass.Documentation
docs/store.md: the grouping paragraph.docs/server.md: the--executorlist now names division,ABS/CEIL/FLOOR/ROUND, thexsd:integerandxsd:decimalcasts,IFandCOALESCE, and points todocs/store.mdfor the full list. This is the follow-up the review of perf(executor): IF and COALESCE on term ids (#11) #172 asked for.Docs checked:
--executor idssection (13-production.md) and the README say nothing about grouping plans or kernel lists, and stay true.Main, with #172, is merged in.