Performance question: Commit or rollback?

From: Chris Angelico <rosuav(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Performance question: Commit or rollback?
Date: 2011-12-18 02:53:00
Message-ID: CAPTjJmp1atMO-Jy+4O6zF2h8P8UxkX7321E3R_nvxqLbNe-ZNA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Some of my code involves transactions which will not have significant
effect on the database. It might be a read-only transaction (possibly
declared as one, but possibly not), or perhaps a completely empty
transaction - I have a framework that will always open a transaction,
then call on other code, and then complete the transaction at the
bottom.

In these instances, is it better to commit or to rollback? Are there
performance penalties to either option?

Similarly, what about when the first action in a transaction puts it
in an error state? Is it better to commit (which should have no effect
- nothing succeeded) or to roll back?

I could test these things experimentally, but am afraid I'll skew my
results based on the data I use. Hoping that somebody here knows for
certain - there does seem to be a wealth of expertise here.

Chris Angelico

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Travers 2011-12-18 03:02:00 Re: Performance question: Commit or rollback?
Previous Message Robert James 2011-12-18 00:06:21 Re: Logical Aggregate Functions (eg ANY())