You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jack Christensen edited this page Sep 17, 2022
·
2 revisions
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.