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

How to update the PostgreSQL config in the local environment? #2611

Open
vinch opened this issue Aug 13, 2024 · 1 comment
Open

How to update the PostgreSQL config in the local environment? #2611

vinch opened this issue Aug 13, 2024 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@vinch
Copy link

vinch commented Aug 13, 2024

Hello,

I tried to setup a local environment and copying my hosted database to my local environment but I encountered some kind of memory issues that you can see here when doing supabase db reset:

Resetting local database...
Recreating database...
Setting up initial schema...
Applying migration 20240813070343_remote_schema.sql...
ERROR: out of shared memory (SQLSTATE 53200)
At statement 843: SECURITY LABEL FOR "pgsodium" ON COLUMN "public"."abc"."cdf" IS 'ENCRYPT WITH KEY ID xyz'
Try rerunning the command with --debug to troubleshoot the error.

When I troubleshoot the issue with the --debug flag, it tells me to update the max_locks_per_transaction value in the PostgreSQL config. By default it's 64 and I would like to upgrade to 512 like I did on my hosted database.

On my hosted database, I was able to do it with the supabase postgres-config update command (documented here https://supabase.com/docs/guides/platform/custom-postgres-config) but it does not seem to work locally as it requires a project-ref that I don't have on my local environment.

So, I decided to go inside the docker instance for my database, find the postgresql.conf file located in /etc/postgresql but if I update the max_locks_per_transaction there and then restart the instance (by doing supabase stop then supabase start), my changes in the postgresql.conf file are erased.

So my question is: what's the best way to update the PostgreSQL config when using a local environment?

Thank you.

@omaiboroda
Copy link

@vinch , we have overcome this with

docker exec -it <container_name> bash -c "echo \"maintenance_work_mem = '128MB'\" >> /etc/postgresql/postgresql.conf && su postgres -c '/usr/lib/postgresql/15/bin/pg_ctl reload'"

@sweatybridge sweatybridge added the enhancement New feature or request label Sep 8, 2024
@sweatybridge sweatybridge added this to the P1 milestone Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants