From 20bb397e00dad9dfdb38d0c8dd73062b448c31e3 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 22 Aug 2018 21:00:01 +0800 Subject: Add database configuration to disable advisory locks. https://github.com/rails/rails/issues/31190 --- guides/source/configuring.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/configuring.md b/guides/source/configuring.md index 6e4f1f9648..36882fec3f 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -989,6 +989,14 @@ development: If your development database has a root user with an empty password, this configuration should work for you. Otherwise, change the username and password in the `development` section as appropriate. +Advisory Locks are enabled by default on MySQL and are used to make database migrations concurrent safe. You can disable advisory locks by setting `advisory_locks` to `false`: + +```yaml +production: + adapter: mysql2 + advisory_locks: false +``` + #### Configuring a PostgreSQL Database If you choose to use PostgreSQL, your `config/database.yml` will be customized to use PostgreSQL databases: @@ -1001,12 +1009,13 @@ development: pool: 5 ``` -Prepared Statements are enabled by default on PostgreSQL. You can disable prepared statements by setting `prepared_statements` to `false`: +By default Active Record uses database features like prepared statements and advisory locks. You might need to disable those features if you're using an external connection pooler like PgBouncer: ```yaml production: adapter: postgresql prepared_statements: false + advisory_locks: false ``` If enabled, Active Record will create up to `1000` prepared statements per database connection by default. To modify this behavior you can set `statement_limit` to a different value: -- cgit v1.2.3