Skip to content

feat(vchordrq): estimate MaxSim planner cost - #477

Draft
HuXinjing wants to merge 1 commit into
supervc-stack:mainfrom
HuXinjing:upstream/maxsim-planner-cost
Draft

feat(vchordrq): estimate MaxSim planner cost#477
HuXinjing wants to merge 1 commit into
supervc-stack:mainfrom
HuXinjing:upstream/maxsim-planner-cost

Conversation

@HuXinjing

Copy link
Copy Markdown

Summary

  • persist the indexed vector/token count in unused MetaTuple padding without changing tuple offsets
  • update the count after index build and bulk deletion
  • add a MaxSim-specific planner model based on heap rows, indexed tokens, probes, query-token count, filters, and LIMIT
  • preserve the existing planner path for every non-MaxSim opfamily

This is the first focused implementation PR proposed in #476. It does not add
an exact reranker, external tensor storage, a network protocol, or GPU code.

Compatibility

The statistic uses the existing 2-byte and 6-byte padding regions in the meta
tuple. Compile-time offset assertions and unit tests protect the on-disk layout.

  • Old indexes expose the statistic as None.
  • The planner falls back to a configurable average document-token count.
  • Build and subsequent vacuum/bulk-delete operations publish an exact count.
  • No REINDEX is required solely for compatibility.

The planner query-token and fallback document-token values are configurable
until expression/page-level statistics are available.

Validation

  • cargo test -p vchordrq
  • cargo test --locked --workspace --exclude vchord --no-fail-fast
  • PostgreSQL 16 release extension build through the repository xtask build
    inside a clean PostgreSQL development container
  • cargo fmt --all -- --check
  • git diff --check

Review notes

The cost constants are intentionally conservative and hardware-independent.
The model prices the eager token search and page aggregation currently
performed by MaxSim. A future optional exact-rerank backend can add its own cost
without changing this candidate-generation model.

Discussion: #476

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@HuXinjing

Copy link
Copy Markdown
Author

Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.

I have read the CLA Document and I hereby sign the CLA

You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

I have read the CLA Document and I hereby sign the CLA

@HuXinjing

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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.

1 participant