A Postgres monitoring script, check_postgres.pl, is warning me that a large number of rollbacks are occurring on a database server. How can I investigate what queries are being rolled back? I have tried searching the Postgres log file but it doesn't contain any instances of the word "rollback" and I can't see anything in the Postgres manual about enabling rollback logging.
Take the 2-minute tour
×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.
I wouldn't expect the mere presence of a rollback to be a problem. There are all kinds of reasons this might happen and nearly all are harmless. A good rule of thumb is that if the application requested a roll back, it is harmless at least for the DBA... The key is to log statements in errors (which would force rollbacks) and investigate those. The other possibility which is possibly concerning is in serialization failures (if using serializable transactions) but here the application has the responsibility of handling the rollback. |
|||
|
log_statement = 'all'
and a suitablelog_line_prefix
. But lots of rollbacks aren't necessarily a problem. Some frameworksROLLBACK
read-only transactions by default. It's generally harmless. – Craig Ringer Jul 7 '14 at 11:24