Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hydra db migration: CREATE INDEX CONCURRENTLY #3892

Open
3 of 5 tasks
harvhan opened this issue Nov 19, 2024 · 1 comment
Open
3 of 5 tasks

hydra db migration: CREATE INDEX CONCURRENTLY #3892

harvhan opened this issue Nov 19, 2024 · 1 comment
Labels
feat New feature or request.

Comments

@harvhan
Copy link

harvhan commented Nov 19, 2024

Preflight checklist

Ory Network Project

No response

Describe your problem

During one of our deployments, we noticed that the hydra db migration 'CREATE INDEX' step took too long while holding a write lock to the database. Since this is a database serving live traffic, we cannot afford to have a long down time.

Describe your ideal solution

Can we consider adding CONCURRENTLY to the CREATE INDEX sql statements, so that the db can still function while creating the indexes?

Workarounds or alternatives

We considered running hydra janitor commands regularly, but it didn't help much and we also really want to have near zero down time.

Version

master

Additional Context

No response

@harvhan harvhan added the feat New feature or request. label Nov 19, 2024
@aeneasr
Copy link
Member

aeneasr commented Nov 19, 2024

We can consider that in the future, but online migrations are generally not available when self-hosting open source and only available when using a build from our Ory Enterprise License. This is because releases in OSS bundle many changes, and releases with OEL happening step with releases to Ory Network which are generally online.

While adding concurrent index creation will solve write locks, it may cause other issues with index hints afaik.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request.
Projects
None yet
Development

No branches or pull requests

2 participants