[Django] #36534: Problem Statement: Spike in PostgreSQL Connections After Upgrading Django from 3.2 to 5.2 Despite CONN_MAX_AGE = 10

4 views
Skip to first unread message

Django

unread,
Jul 31, 2025, 4:28:04 AMJul 31
to django-...@googlegroups.com
#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.

Django

unread,
Jul 31, 2025, 7:18:52 AMJul 31
to django-...@googlegroups.com
#36534: Problem Statement: Spike in PostgreSQL Connections After Upgrading Django
from 3.2 to 5.2 Despite CONN_MAX_AGE = 10
-------------------------------------+-------------------------------------
Reporter: ps018w | Owner: (none)
Type: New feature | Status: closed
Component: Database layer | Version: 5.2
(models, ORM) |
Severity: Release blocker | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* resolution: => needsinfo
* status: new => closed

Comment:

Thanks for the report. However, I don't think you've explained the issue
in enough detail to confirm a bug in Django. It's hard to say without a
sample project.

Please reopen the ticket if you can debug your issue and provide details
about why and where Django is at fault, or if you can provide a sample
project with reproducible scenario.

Note that I see you have posted on the forum
(https://forum.djangoproject.com/t/problem-statement-spike-in-postgresql-
connections-after-upgrading-django-from-3-2-to-5-2-despite-conn-max-
age-10/42146), I think it makes sense to provide more details on your
project there and debug with the community to determine what is the cause
of the spike.
--
Ticket URL: <https://code.djangoproject.com/ticket/36534#comment:1>
Reply all
Reply to author
Forward
0 new messages