pgx
pgx copied to clipboard
Guidance on prepared Statements
Hey! Jack firstly thanks for the library.
As pgxpool automatically creates prepared statement. I thought of checking whether my queries are used as prepared statements.
Can you guide me further please!!!!
I have added following config
config, err := pgxpool.ParseConfig(dsn)
if err != nil {
return nil, err
}
config.ConnConfig.DefaultQueryExecMode = pgx.QueryExecModeCacheStatement
config.ConnConfig.StatementCacheCapacity = 100
config.ConnConfig.DescriptionCacheCapacity = 0
When I checked Select * from pg_prepared_statements in postgres couldn't find any info. Can you please guide further please..... Kindly help..
Each conn has their own prepared statement cache. pgxpool doesn't maintain the cache.
The view pg_prepared_statements is local to each connection. You can only see the statements from the connection that has prepared them.