aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/configuring.md
diff options
context:
space:
mode:
authorGuo Xiang Tan <tgx_world@hotmail.com>2018-08-22 21:00:01 +0800
committerGuo Xiang Tan <tgx_world@hotmail.com>2018-08-22 22:06:08 +0800
commit20bb397e00dad9dfdb38d0c8dd73062b448c31e3 (patch)
tree1c78f25256c8cd1353097f35edaf848db304e6a0 /guides/source/configuring.md
parent96ac7e4cdee004bcd19cb63b3e3396329e3b39ed (diff)
downloadrails-20bb397e00dad9dfdb38d0c8dd73062b448c31e3.tar.gz
rails-20bb397e00dad9dfdb38d0c8dd73062b448c31e3.tar.bz2
rails-20bb397e00dad9dfdb38d0c8dd73062b448c31e3.zip
Add database configuration to disable advisory locks.
https://github.com/rails/rails/issues/31190
Diffstat (limited to 'guides/source/configuring.md')
-rw-r--r--guides/source/configuring.md11
1 files changed, 10 insertions, 1 deletions
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: