pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robins Tharakan <tharakan@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Performance Implications of Using Exceptions
Date: Tue, 01 Apr 2008 00:29:35 -0400
Message-ID: <20193.1207024175@sss.pgh.pa.us> (raw)
In-Reply-To: <36af4bed0803311926v20f9c0cbkbd2869232dc547a@mail.gmail.com>
References: <7a4208ef0803311720s1dac8362gff2477d3dc534968@mail.gmail.com>
	<20080401005235.GM4999@tamriel.snowman.net>
	<F0238EBA67824444BC1CB4700960CB4804F8B1BA@dmpeints002.isotach.com>
	<36af4bed0803311923u67641f1w489acad42412fb3d@mail.gmail.com>
	<36af4bed0803311926v20f9c0cbkbd2869232dc547a@mail.gmail.com>

"Robins Tharakan" <tharakan@gmail.com> writes:
> Would it fine to consider that an UPDATE query that found no records to
> update is (performance wise) the same as a SELECT query with the same WHERE
> clause ?

> As in, does an UPDATE query perform additional overhead even before it finds
> the record to work on ?

The UPDATE would fire BEFORE STATEMENT and AFTER STATEMENT triggers, if
there are any.  Also, it would take a slightly stronger lock on the
table, which might result in blocking either the UPDATE itself or some
concurrent query where a plain SELECT would not've.

There might be some other corner cases I've forgotten.  But in the basic
case I think your assumption is correct.

			regards, tom lane



view thread (11+ messages)  latest in thread

Message-ID: <20193.1207024175@sss.pgh.pa.us>
Permalink:  ../20193.1207024175@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20193.1207024175@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tharakan@gmail.com
  Subject: Re: Performance Implications of Using Exceptions
  In-Reply-To: <20193.1207024175@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox