Skip to content

Optimize native text arrays and independent document batches - #4

Merged
DeoLeung merged 1 commit into
mainfrom
codex/pinyin-array-batch-perf
Oct 13, 2026
Merged

DeoLeung merged 1 commit into
mainfrom
codex/pinyin-array-batch-perf

Conversation

@DeoLeung

Copy link
Copy Markdown
Contributor

Summary

  • Decode native text[] token inputs directly in Rust, removing SPI/JSON conversion while preserving existing anyelement OIDs and fallback semantics.
  • Add Rust-exported independent-document batch APIs with one live dictionary version check per bounded batch.
  • Guard reused-version counters after savepoint rollback using metadata xmin; preserve generated columns, dictionary edits, suffix cache behavior and parallel safety.
  • Keep the existing unreleased 0.0.9 version and extend the 0.0.8-to-0.0.9 migration. No release bump, tag, dictionary replacement or SQL-backend coupling.

Validation

  • cargo fmt/check passed; 16 Rust unit tests passed.
  • 88 Python tests and 875 pgTAP assertions passed locally on PG19 beta4 / source-built pg_search 0.26.1.
  • Genuine 0.0.8 upgrade, fresh install with/without pg_search, old OID/generated-value retention, real TOAST arrays, cache rollback and launched parallel read-only workers covered.
  • Deterministic dictionary regeneration leaves sql/data unchanged.

Benchmark

  • Fresh isolated database; 20,000 documents; three rotated repeats; independent real old/current release-profile DLLs using the same compiler.
  • Warm native token conversion: 623.978 -> 261.685 ms (2.38x).
  • Warm batch512 INSERT vs old scalar: 321.993 -> 41.592 ms (7.74x).
  • Raw samples, artifact/source hashes, exact SQL, output parity and limits are in benchmarks/p2_array_batch.{md,json}.
  • Precomputed inputs; shared host; server-side conversion and heap/PK writes only. Excludes client preparation/upload and BM25 maintenance. Different batch layouts are not a single-change ablation.

Scope

@DeoLeung
DeoLeung merged commit b29763b into main Oct 13, 2026
8 checks passed
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