Skip to content

feat(inspect): expose automatic nlist sizing - #444

Open
erimatnor wants to merge 1 commit into
mainfrom
feature/auto-nlist
Open

erimatnor wants to merge 1 commit into
mainfrom
feature/auto-nlist

Conversation

@erimatnor

Copy link
Copy Markdown
Member

Let callers predict the list count a rebuild would target without copying the sizing rule into SQL. Validate index settings and bound large row counts before the shared calculation narrows them.

Closes #406

Let callers predict the list count a rebuild would target without copying the sizing rule into SQL. Validate index settings and bound large row counts before the shared calculation narrows them.
@erimatnor
erimatnor requested review from jgpruitt and a balanced review from Copilot December 1, 2026 10:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block approval of the SQL list-count sizing helper.

No open issues 🎉

What changed in this PR

Exposes PRISM’s shared automatic list-count calculation through SQL, allowing callers to estimate rebuild sizing without duplicating the formula.

Changes:

  • Adds prism_auto_nlist(row_count, dim, target_pages) to fresh installs and upgrades.
  • Validates dimensions and page targets, and safely caps large row counts.
  • Documents usage and adds regression cases for sizing, limits, invalid inputs, and NULL handling.
File Description
test/​pg/​sql/​inspect.sql Adds automatic-sizing regression cases.
test/​pg/​expected/​inspect.out Records expected sizing results and validation errors.
src/​pg/​build.c Adds the SQL-callable wrapper with validation and overflow protection.
sql/​pg_vectorsearch.sql Registers the helper for fresh installations.
sql/​pg_vectorsearch--0.2.0--0.3.0-dev.sql Registers the helper during upgrades.
README.md Introduces the sizing helper and its optional argument.
docs/​tuning.md Explains target sizing, bounds, and differences from built list counts.

Review effort: Balanced

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Coverage

Total coverage: 92%

Full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

inspect: expose prism_auto_nlist() or report target auto_nlist in prism_index_settings()

3 participants