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.