Skip to content

[Postgres Storage] Parameter index compacting - #761

Draft
rkistner wants to merge 24 commits into
mainfrom
incremental-parameter-index-postgres
Draft

[Postgres Storage] Parameter index compacting#761
rkistner wants to merge 24 commits into
mainfrom
incremental-parameter-index-postgres

Conversation

@rkistner

Copy link
Copy Markdown
Contributor

This ports #759 to Postgres storage. Postgres storage had no parameter index compacting before, so this adds a new implementation matching the new MongoDB one.

To a large extent this is a direct port of the MongoDB implementation: Postgres uses the same basic storage structure for this as MongoDB v1 storage. This does make the implementation slightly simpler, as we don't have to cater for multiple collections like MongoDB v3 storage.

There are still some notable differences due to how the parameters are read with Postgres:

  1. Our Postgres storage does not attempt to detect changes to bucket data or parameter indexes yet - it refreshes them all on every new checkpoint. This removes that need for the compact fence we have for MongoDB.
  2. Our Postgres storage does not use snapshot reads for parameter indexes like our MongoDB storage. It was not previously required due to not having compacting. Postgres does have some options for that, but it is more complex than on MongoDB, and can block other operations such as VACUUM on the db. Instead, we use the same compact fence concept we have on MongoDB, but use that to invalidate the entire checkpoint.

So overall we do still use the same compact fence implementation, but for a different reason.

Migration

This adds two new fields on the sync_rules table, which is a fast migration. This does not touch the potentially large bucket_parameters table.

Status & AI Usage

This is completely ported/vibe-coded using Claude Opus 5.

I have not manually reviewed this yet. The priority right now is to get #759 shipped, but in the meantime this serves to demonstrate we can quickly port the changes afterwards. For this reason I'm not using a pull request stack here.

@changeset-bot

changeset-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6314b85

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Base automatically changed from incremental-compacting to main August 21, 2026 08:12
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