summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/pypostgresql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-01-01 13:21:55 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2021-01-02 22:09:39 -0500
commitdd41a5e61a30a2d05ee09f583fdfde1f1c204807 (patch)
tree0d03b3f15c3b76ad3c0da5a75ddf524b326d58e2 /lib/sqlalchemy/dialects/postgresql/pypostgresql.py
parent1c35a3790c1f186b91d556fb161c1958cbf718bb (diff)
downloadsqlalchemy-dd41a5e61a30a2d05ee09f583fdfde1f1c204807.tar.gz
Cache asyngpg prepared statements
Enhanced the performance of the asyncpg dialect by caching the asyncpg PreparedStatement objects on a per-connection basis. For a test case that makes use of the same statement on a set of pooled connections this appears to grant a 10-20% speed improvement. The cache size is adjustable and may also be disabled. Unfortunately the caching gets more complicated when there are schema changes present. An invalidation scheme is now also added to accommodate for prepared statements as well as asyncpg cached OIDs. However, the exception raises cannot be prevented if DDL has changed database structures that were cached for a particular asyncpg connection. Logic is added to clear the caches when these errors occur. Change-Id: Icf02aa4871eb192f245690f28be4e9f9c35656c6
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/pypostgresql.py')
0 files changed, 0 insertions, 0 deletions