Performance question: Commit or rollback? - Mailing list pgsql-general

From Chris Angelico
Subject Performance question: Commit or rollback?
Date
Msg-id CAPTjJmp1atMO-Jy+4O6zF2h8P8UxkX7321E3R_nvxqLbNe-ZNA@mail.gmail.com
Whole thread Raw
Responses Re: Performance question: Commit or rollback?
List 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

pgsql-general by date:

Previous
From: Robert James
Date:
Subject: Re: Logical Aggregate Functions (eg ANY())
Next
From: Chris Travers
Date:
Subject: Re: Performance question: Commit or rollback?