#36534: Problem Statement: Spike in PostgreSQL Connections After Upgrading Django
from 3.2 to 5.2 Despite CONN_MAX_AGE = 10
-------------------------------------+-------------------------------------
Reporter: ps018w | Type: New
| feature
Status: new | Component: Database
| layer (models, ORM)
Version: 5.2 | Severity: Release
| blocker
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
After upgrading our Django application from version 3.2 to 5.2, we started
observing unexpected spikes in active PostgreSQL database connections.
This issue arises despite having CONN_MAX_AGE set to 10, which should
allow persistent connections to be reused within a 10-second window,
thereby preventing rapid connection churn.
Current Database Configuration:
DATABASES
={"default":env.db("DATABASE_URL",default="postgres://localhost/test"), }
DATABASES["default"]["ATOMIC_REQUESTS"] = False
DATABASES["default"]["CONN_MAX_AGE"] = 10
The connection spike behavior was not observed prior to the upgrade,
indicating a possible change in how Django 5.2 manages database
connections, or a change in default behavior for connection pooling or
request handling.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36534>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.