Re: SELECT overhead in explicit transaction

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: blair(dot)bethwaite(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SELECT overhead in explicit transaction
Date: 2008-03-12 06:10:39
Message-ID: 13197.1205302239@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Blair Bethwaite" <blair(dot)bethwaite(at)infotech(dot)monash(dot)edu(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2008-03-12 06:18:24 Re: Problem with starting PostgreSQL server 7.4.19
Previous Message Kakoli Sen 2008-03-12 06:07:21 Re: Problem with starting PostgreSQL server 7.4.19