How to increase `max_locks_per_transaction` in Laravel Sail?

11 Views Asked by At

How do you configure max_locks_per_transaction in docker-compose.yml for Laravel Sail?

  • I have research if there was an env var that could be used
  • tried running SQL commands, but they only applied the change temporarily

These did not yield the expected results.

1

There are 1 best solutions below

0
On

I was able to achieve the result using the following entry:

command: -c 'max_locks_per_transaction=8192'

Here's the complete pgsql section for context:

    pgsql:
        image: 'postgres:14'
        ports:
            - '${FORWARD_DB_PORT:-5432}:5432'
        command: -c 'max_locks_per_transaction=8192'
        environment:
            PGPASSWORD: '${DB_PASSWORD:-secret}'
            POSTGRES_DB: '${DB_DATABASE}'
            POSTGRES_USER: '${DB_USERNAME}'
            POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}'
        volumes:
            - 'sail-pgsql:/var/lib/postgresql/data'
            - './docker/pgsql/create-testing-database.sql:/docker-entrypoint-initdb.d/10-create-testing-database.sql'
        networks:
            - sail
        healthcheck:
            test: ["CMD", "pg_isready", "-q", "-d", "${DB_DATABASE}", "-U", "${DB_USERNAME}"]
            retries: 3
            timeout: 5s