Re: Performance Implications of Using Exceptions - Mailing list pgsql-performance

From Tom Lane
Subject Re: Performance Implications of Using Exceptions
Date
Msg-id 20193.1207024175@sss.pgh.pa.us
Whole thread Raw
In response to Re: Performance Implications of Using Exceptions  ("Robins Tharakan" <tharakan@gmail.com>)
List pgsql-performance
"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

pgsql-performance by date:

Previous
From: "Robins Tharakan"
Date:
Subject: Re: Performance Implications of Using Exceptions
Next
From: Tom Lane
Date:
Subject: Re: POSIX file updates