Skip to content

Fix PostgreSQL index names and bootstrap races - #51

Merged
eldonm merged 1 commit into
mainfrom
codex/postgres-index-name-limit
Oct 3, 2026
Merged

eldonm merged 1 commit into
mainfrom
codex/postgres-index-name-limit

Conversation

@eldonm

@eldonm eldonm commented Oct 3, 2026

Copy link
Copy Markdown
Member

Summary

Generated PostgreSQL compound index names could exceed PostgreSQL's 63-byte identifier limit, causing important typed unique indexes to be skipped. Concurrent first use could also race while creating the same collection table and fail with a duplicate type error.

This change retains existing short index names, uses a stable digest for longer names while preserving the suffix, and serializes first-use schema creation per collection. It updates the PostgreSQL contract and changelog.

Validation

  • Full suite with coverage and a disposable PostgreSQL 16 service
  • Targeted PostgreSQL index creation/idempotence and concurrent bootstrap tests
  • check yaml...............................................................Passed
    check json...............................................................Passed
    trim trailing whitespace.................................................Passed
    black....................................................................Passed
    isort....................................................................Passed
    flake8...................................................................Passed
    mypy.....................................................................Passed
    Detect Secrets...........................................................Passed

One initial full-suite run reproduced the concurrent bootstrap race; it passed after the per-collection lock was added.

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

Benchmark comparison

Threshold: ±25% (informational, does not block merge)

benchmark baseline (s) current (s) delta status
tests/benchmarks/test_deferred_save_benchmarks.py::test_bench_deferred_save_batched_100 0.015681 0.021031 +34.1% REGRESSION (+34.1%)
tests/benchmarks/test_deferred_save_benchmarks.py::test_bench_immediate_save_100 0.016093 0.019963 +24.0% OK
tests/benchmarks/test_jsondb_benchmarks.py::test_bench_jsondb_batched_saves_500 0.639179 0.389805 -39.0% IMPROVED (-39.0%)
tests/benchmarks/test_jsondb_benchmarks.py::test_bench_jsondb_count_empty_query 1.045313 0.834264 -20.2% OK
tests/benchmarks/test_jsondb_benchmarks.py::test_bench_jsondb_count_filtered 0.930707 0.983439 +5.7% OK
tests/benchmarks/test_jsondb_benchmarks.py::test_bench_jsondb_find_filtered 1.077336 0.743033 -31.0% IMPROVED (-31.0%)
tests/benchmarks/test_jsondb_benchmarks.py::test_bench_jsondb_save_throughput 0.002232 0.001444 -35.3% IMPROVED (-35.3%)
tests/benchmarks/test_sqlite_benchmarks.py::test_bench_sqlite_count_empty 0.200982 0.224410 +11.7% OK
tests/benchmarks/test_sqlite_benchmarks.py::test_bench_sqlite_count_fallback_via_regex 0.280437 0.347547 +23.9% OK
tests/benchmarks/test_sqlite_benchmarks.py::test_bench_sqlite_count_pushdown 0.197793 0.277714 +40.4% REGRESSION (+40.4%)
tests/benchmarks/test_sqlite_benchmarks.py::test_bench_sqlite_find_fallback_via_regex 0.275584 0.332843 +20.8% OK
tests/benchmarks/test_sqlite_benchmarks.py::test_bench_sqlite_find_pushdown 0.173991 0.217105 +24.8% OK
tests/benchmarks/test_sqlite_benchmarks.py::test_bench_sqlite_sort_limit_pushdown 0.221253 0.283424 +28.1% REGRESSION (+28.1%)

@eldonm eldonm self-assigned this Oct 3, 2026
@eldonm
eldonm merged commit a1f42e4 into main Oct 3, 2026
6 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