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.

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.

share|improve this question
2  
Probably have to set log_statement = 'all' and a suitable log_line_prefix. But lots of rollbacks aren't necessarily a problem. Some frameworks ROLLBACK read-only transactions by default. It's generally harmless. –  Craig Ringer Jul 7 '14 at 11:24

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.