← Back to Pull requests

feat: add additional per-table storage parameters #133

Closed
arreyder closed this pull request without merging on Apr 28, 2026 15:22 UTC
View on GitHub
arreyder arreyder commented on Feb 22, 2026 15:41 UTC
Author

Summary

Adds 6 PostgreSQL table-level storage parameters to StorageParameters, all confirmed valid via PostgreSQL 17 docs (CREATE TABLE → Storage Parameters):

  • parallel_workers — number of workers for parallel table scans

  • autovacuum_multixact_freeze_min_age / max_age / table_age — completes the multixact freeze family alongside the existing freeze age params

  • log_autovacuum_min_duration — log autovacuum runs exceeding this duration (ms)

  • vacuum_index_cleanup — whether vacuum should process indexes (enum AUTO/ON/OFF)
  • Full support in CREATE TABLE (WITH clause), ALTER TABLE (SET), and code generation. Test cases cover all parameters in both new-table and existing-table paths.

    Removed: default_statistics_target

    An earlier revision of this PR also added default_statistics_target as a table-level storage parameter. That was incorrect — per PG17 docs, default_statistics_target is only valid as the server GUC or as a per-column override via ALTER TABLE … ALTER COLUMN … SET STATISTICS N. It is not in the table-level WITH(...) allow-list. The previous PR shape would have generated SQL Postgres rejects with unrecognized parameter "default_statistics_target".

    Field number 13 and the name default_statistics_target are now reserved on StorageParameters so a future per-column field-option PR doesn't collide here.

    Usage

    message MyHighChurnTable {
      option (pgdb.v1.msg) = {
        storage_parameters: {
          parallel_workers: 4
          log_autovacuum_min_duration: 250
          autovacuum_multixact_freeze_max_age: 200000000
          vacuum_index_cleanup: false
        }
      };
    }
    

    Test plan

  • go vet ./... passes

  • go build ./... passes

  • go test ./pgdb/v1/ -run TestStorageParams — all pass (TestStorageParams2with + TestStorageParams2alter)

  • buf generate proto clean

  • buf generate --template buf.example.gen.yaml --path example/models clean
  • Follow-up (out of scope)

    Per-column SET STATISTICS belongs in FieldOptions on the proto field, not in StorageParameters on the message. Will be a separate PR — (pgdb.v1.options).statistics_target = N annotation that emits ALTER TABLE … ALTER COLUMN … SET STATISTICS N for each annotated column. Tracked separately so this PR can land for the storage-parameter scope.

    🤖 Generated with Claude Code

    Diff: 306 lines (+229 / -77) across 3 files Reviewer: pquerna Review duration: 93580m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 306 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.343
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #133"
    general weight: 0.35
    Reviewers
    Assignees
    arreyder arreyder
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.2% (MEDIUM) · Higher = larger blast radius
    40.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.9% · Safe to merge
    15.9%