Skip to content

Commit d968ff5

Browse files
committed
skills and scripts to help diagnose regressions
1 parent 26473bf commit d968ff5

3 files changed

Lines changed: 703 additions & 1 deletion

File tree

.codex/skills/query-plan-snapshot-cli/SKILL.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,62 @@ description: Use QueryPlanSnapshotCli to capture and compare RDF4J query plans,
55

66
# query-plan-snapshot-cli
77

8-
Use this skill to run reproducible query-plan captures and classify likely regression/improvement signals.
8+
Use this skill to run reproducible query-plan captures, triage historical theme-query benchmark results, and classify likely regression/improvement signals.
99

1010
## Fast workflow
1111

12+
1. Capture raw benchmark output into a normalized result file when needed.
13+
2. Analyze the newest dated run against historical results.
14+
3. Drill into the fastest known runs for a specific theme/query.
15+
4. If needed, capture baseline/candidate plan snapshots and diff them semantically.
16+
17+
## History triage
18+
19+
Result files live in:
20+
21+
- `core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/benchmark/theme-query-benchmark-results`
22+
23+
Normalize raw JMH output into a new result file:
24+
25+
- `pbpaste | scripts/theme-query-benchmark-results.sh capture`
26+
- `scripts/theme-query-benchmark-results.sh capture raw-jmh.txt`
27+
28+
Analyze only the queries that are more than 20% slower than history:
29+
30+
- `core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/benchmark/theme-query-benchmark-results/analyze-theme-query-history.sh`
31+
32+
Sort regressions from biggest to smallest:
33+
34+
- `core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/benchmark/theme-query-benchmark-results/analyze-theme-query-history.sh --sort-regressions`
35+
36+
Only print the top N regressions:
37+
38+
- `core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/benchmark/theme-query-benchmark-results/analyze-theme-query-history.sh --top 10`
39+
40+
Analyze every latest query, including current-run wins over previous best:
41+
42+
- `core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/benchmark/theme-query-benchmark-results/analyze-theme-query-history.sh --all`
43+
44+
Drill into the three fastest known runs for one theme/query and print optimized plan/query when present:
45+
46+
- `core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/benchmark/theme-query-benchmark-results/analyze-theme-query-history.sh --theme PHARMA --query-index 10`
47+
48+
Interpretation:
49+
50+
- Default mode: newest dated file only for the “latest” baseline; compares against all other `results-*.md`, including `results-develop.md` and `results-main-branch.md`, but prints only queries where latest is more than 20% slower than historical best.
51+
- `--sort-regressions`: flat regression list, biggest slowdown first.
52+
- `--top N`: top N regressions only; implies regression sorting.
53+
- `--all`: prints every latest query; if latest is a new best it prints how much faster it is than the previous best.
54+
- Query detail mode: top three runs sorted by score ascending; ties prefer richer files with plan/query content.
55+
- `plan no | query yes`: optimized query rendered, no physical plan block in that result file.
56+
- `plan no | query no`: summary-only run or no per-query capture in that file.
57+
58+
Use this path when the goal is optimizer-loop work: find the fastest known plan/query for a theme/query, then compare new runs back to that history before touching production logic.
59+
60+
## Snapshot diff workflow
61+
62+
Use this when you need semantic plan diffs between two controlled captures of the same query.
63+
1264
1. Capture baseline run (main/reference commit).
1365
2. Capture candidate run (changed commit) with same query selector + `--query-id`.
1466
3. Produce semantic diff (`--compare-existing`).

0 commit comments

Comments
 (0)