diff options
| author | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2023-12-11 11:37:54 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2024-03-01 09:01:18 +0100 |
| commit | fad334e1a9b54ea1acb8cce02a25934c5acfe99f (patch) | |
| tree | 4fc84e9981d6cdc83175d88eaa59c251cda009e7 /docs/ref/databases.txt | |
| parent | bcccea3ef31c777b73cba41a6255cd866bf87237 (diff) | |
Refs #33497 -- Added connection pool support for PostgreSQL.
Co-authored-by: Florian Apolloner <florian@apolloner.eu>
Co-authored-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'docs/ref/databases.txt')
| -rw-r--r-- | docs/ref/databases.txt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index 1bc787671e..acebfdf348 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -245,6 +245,31 @@ database configuration in :setting:`DATABASES`:: }, } +.. _postgresql-pool: + +Connection pool +--------------- + +.. versionadded:: 5.1 + +To use a connection pool with `psycopg`_, you can either set ``"pool"`` in the +:setting:`OPTIONS` part of your database configuration in :setting:`DATABASES` +to be a dict to be passed to :class:`~psycopg:psycopg_pool.ConnectionPool`, or +to ``True`` to use the ``ConnectionPool`` defaults:: + + DATABASES = { + "default": { + "ENGINE": "django.db.backends.postgresql", + # ... + "OPTIONS": { + "pool": True, + }, + }, + } + +This option requires ``psycopg[pool]`` or :pypi:`psycopg-pool` to be installed +and is ignored with ``psycopg2``. + .. _database-server-side-parameters-binding: Server-side parameters binding |
