Re: SELECT overhead in explicit transaction - Mailing list pgsql-general

From Tom Lane
Subject Re: SELECT overhead in explicit transaction
Date
Msg-id 13197.1205302239@sss.pgh.pa.us
Whole thread Raw
In response to SELECT overhead in explicit transaction  ("Blair Bethwaite" <blair.bethwaite@infotech.monash.edu.au>)
List pgsql-general
"Blair Bethwaite" <blair.bethwaite@infotech.monash.edu.au> writes:
> I'm wondering whether there would be any extra overhead (CPU, memory,
> io, etc), above and beyond the implicit ACCESS SHARE, incurred by
> putting a simple SELECT into a transaction block?

Every PG command is executed in a transaction, whether explicit or
implicit.  So there is not really any difference on the backend side
between "SELECT blah" and "BEGIN; SELECT blah; COMMIT".  However the
latter definitely can have some extra overhead.  At minimum the server
has got to parse two more statements, even though they don't do very
much when executed.  What is really likely to hurt, though, is if your
client-side code is such that you incur three round trips to the server
instead of just one ...

            regards, tom lane

pgsql-general by date:

Previous
From: "Kakoli Sen"
Date:
Subject: Re: Problem with starting PostgreSQL server 7.4.19
Next
From: Craig Ringer
Date:
Subject: Re: Problem with starting PostgreSQL server 7.4.19