On 12/02/2014 06:17 PM, Olivier MATROT wrote:
> I was wondering if there was a log level in PostgreSQL that could tell
> me which query was the trigger of a doomed transaction.
It's not necessarily possible to tell which *query* in another
transaction caused the current one to fail. It might not be a single
query in the local session or the other session.
What can be identified is the other transaction ID. If you set
log_line_prefix to include the txid and pid, and you log_statement =
'all', you can examine the logs to see what happened.
I admit it's pretty clumsy. It'd be very nice to provide more
information on the causes of failures - but I suspect doing so
*efficiently*, without making serializable a huge impact on performance,
would be quite challenging.
-- Craig Ringer http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services