Use ranked scans for generic prepared search queries - #32
Merged
Merged
Conversation
bweis
added this pull request to stack #33
September 19, 2026 20:34
This was referenced Sep 19, 2026
…-pressure # Conflicts: # source-provenance.json
bweis
force-pushed
the
perf/generic-ranked-plans
branch
from
September 19, 2026 22:50
7d441c1 to
eefb723
Compare
…plans # Conflicts: # benchmarks/tin.py
… perf/generic-ranked-plans # Conflicts: # docs/benchmarks/generic-ranked-plans.md
bweis
marked this pull request as ready for review
September 19, 2026 22:52
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.
Generic prepared searches retain a text parameter, which previously prevented the ranked custom scan from being offered. Bind external query parameters when the ranked scan executes, and clear/rebind state on rescans. NULL returns no matches; malformed executions and changing parameters preserve normal error and scoring behavior.
Four alternating before/after trials on a fixed 1,000-document Wikipedia prefix, all 906 trace forms, force_generic_plan, 2 clients, 4 CPUs/4 GiB completed with membership and exhaustive ranked checks passing. Median QPS increased 27.1 → 6,301.2; median p95 decreased 79.109 → 0.714 ms. The paired throughput ratio was 232.208x (range 231.692–232.723x). This is a small-corpus forced-generic diagnostic, not capacity or automatic-plan performance; trials predate explicit visibility-map capture. Full protocol, source/image identities, and limitations are retained in docs/benchmarks/generic-ranked-plans.md and generic-ranked-results.json.
Validation: PostgreSQL 17/18 on x86-64/ARM64 and upstream Lead oracle passed at the measured implementation
7d441c1. Reporting/stack integration now passes 122 Python tests and 171 source-header checks; CI reruns on the final head. Parameterized LIMIT bounds are handled separately in PR36.