Skip to content

IndexStorage implementation for postgres#2954

Merged
kmatasfp merged 7 commits intomainfrom
2951-indexstorage-for-postgres
Mar 10, 2026
Merged

IndexStorage implementation for postgres#2954
kmatasfp merged 7 commits intomainfrom
2951-indexstorage-for-postgres

Conversation

@kmatasfp
Copy link
Contributor

@kmatasfp kmatasfp commented Mar 9, 2026

Resolves: #2951

Postgre IndexStorage implementation for worker executor can be enabled with:

GOLEM__INDEXED_STORAGE__TYPE="Postgres"
GOLEM__INDEXED_STORAGE__CONFIG__HOST="your-postgres-endpoint"
GOLEM__INDEXED_STORAGE__CONFIG__PORT=5432
GOLEM__INDEXED_STORAGE__CONFIG__DATABASE="golem_worker_executor"
GOLEM__INDEXED_STORAGE__CONFIG__USERNAME="postgres"
GOLEM__INDEXED_STORAGE__CONFIG__PASSWORD="***"
GOLEM__INDEXED_STORAGE__CONFIG__MAX_CONNECTIONS=10

@kmatasfp kmatasfp requested review from mschuwalow, noise64 and vigoo March 9, 2026 19:02

CREATE INDEX IF NOT EXISTS idx_index_storage_ns_key ON index_storage (namespace, key);

ALTER TABLE index_storage SET (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi all the config here is to make drop_prefix less painful

Copy link
Contributor Author

@kmatasfp kmatasfp Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prob still need to tune these based on how it behaves in the wild, but should be good starting point

Copy link
Contributor

@noise64 noise64 Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks reasonable, but i would like to add some periodic montiroing on the stats, vacumming and CPU (as a separate issue, later), so we can see how these perform (and this is just a generic reminder, we also should monitor our other postgres instances)


CREATE INDEX IF NOT EXISTS idx_index_storage_ns_key ON index_storage (namespace, key);

ALTER TABLE index_storage SET (
Copy link
Contributor

@noise64 noise64 Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks reasonable, but i would like to add some periodic montiroing on the stats, vacumming and CPU (as a separate issue, later), so we can see how these perform (and this is just a generic reminder, we also should monitor our other postgres instances)

id BIGINT NOT NULL,
value BYTEA NOT NULL,
PRIMARY KEY (namespace, key, id)
);
Copy link
Contributor

@noise64 noise64 Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing we might want to consider is partioning by HASH(namespace, key), which is probably easy to add now, and can help us buying more time until we want to use a more scaleable backend. I will think a bit more about this, and we can discuss / add it as a seperate card, if we wan to, until release.

namespace: IndexedStorageMetaNamespace,
pattern: &str,
cursor: ScanCursor,
count: u64,
Copy link
Contributor

@noise64 noise64 Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a generic comment, not for this issue and backend: after discussing with @vigoo a bit, we might want to make the ScanCursor string based (instead of integer), that ideally could allow us making scanning perform better, e.g. with progress, we could skip the offset part, and use the index directly.

this is also something, that i would like to think a bit more, and discuss / solve as a separate issue, if needed.

@kmatasfp kmatasfp merged commit 3529422 into main Mar 10, 2026
27 checks passed
@kmatasfp kmatasfp deleted the 2951-indexstorage-for-postgres branch March 10, 2026 17:57
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IndexedStorage trait implementation for Postgres

4 participants