patternsqlMinor
Is it possible to obtain number of prepared statements a connection holds?
Viewed 0 times
numberobtainstatementspossiblepreparedholdsconnection
Problem
I have a heavy loaded application that holds connections persistently (it creates them on start and never releases).
During the lifetime it creates and (re)uses prepared statements, which are stored in an LRU structure (so the least used are eventually released).
And the question is: is it possible to obtain the number and other statistics of prepared statements for a given connection?
There is nothing relevant on http://www.postgresql.org/docs/9.3/static/monitoring-stats.html so not sure if there are other interfaces to access postgresql stats.
UPD: I probably was not clear enough: I need to obtain information using the normal DBA connection, since I cannot run arbitrary queries from the production software. For that very reason the
During the lifetime it creates and (re)uses prepared statements, which are stored in an LRU structure (so the least used are eventually released).
And the question is: is it possible to obtain the number and other statistics of prepared statements for a given connection?
There is nothing relevant on http://www.postgresql.org/docs/9.3/static/monitoring-stats.html so not sure if there are other interfaces to access postgresql stats.
UPD: I probably was not clear enough: I need to obtain information using the normal DBA connection, since I cannot run arbitrary queries from the production software. For that very reason the
pg_prepared_statements solution would not work.Solution
You can view prepared statements with the
pg_prepared_statements view. Query this view to get a count.Context
StackExchange Database Administrators Q#122236, answer score: 2
Revisions (0)
No revisions yet.