Created Automatic Prepared Statement Caching (markdown)

Jack Christensen 2020-05-16 10:20:35 -05:00
parent 41bdf959d1
commit e4b9bf8607

@ -0,0 +1,13 @@
# Automatic Prepared Statement Caching
By default pgx automatically prepares and caches queries. pgx also supports manually preparing and executing statements, but it should rarely be necessary.
While this automatic caching typically provides a significant performance improvement it does impose a restriction that the same SQL query always has the same parameter and result types. Otherwise an error will occur.
For example, the query `select * from foo` will fail if a column is added or removed to `foo` after the statement is cached.
This error can also be triggered by cursors that return different result types.
Another incompatibility is with PgBouncer. PgBouncer does not support prepared statements.
In any case, statement caching can be disabled by connecting with `statement_cache_capacity=0`.