Re: Performance Implications of Using Exceptions

From: "Stephen Denne" <Stephen(dot)Denne(at)datamail(dot)co(dot)nz>
To: "Ravi Chemudugunta" <chemuduguntar(at)gmail(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Performance Implications of Using Exceptions
Date: 2008-04-01 00:56:35
Message-ID: F0238EBA67824444BC1CB4700960CB4804F8B1BA@dmpeints002.isotach.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Stephen Frost wrote
> * Ravi Chemudugunta (chemuduguntar(at)gmail(dot)com) wrote:
> > Which version is faster?
>
> In general I would recommend that you benchmark them using
> as-close-to-real load as possible again as-real-as-possible data.
>
> > Does the exception mechanism add any overhead?
>
> Yes, using exceptions adds a fair bit of overhead. Quote from the
> documentation found here:
> http://www.postgresql.org/docs/8.3/static/plpgsql-control-stru
> ctures.html
>
> Tip: A block containing an EXCEPTION clause is significantly more
> expensive to enter and exit than a block without one. Therefore, don't
> use EXCEPTION without need.
>
> > Which is more cleaner?
>
> That would be in the eye of the beholder, generally. Given
> the lack of
> complexity, I don't think 'cleanness' in this case really matters all
> that much.

A third option is to update, if not found, insert.

Regards,
Stephen Denne.

Disclaimer:
At the Datamail Group we value team commitment, respect, achievement, customer focus, and courage. This email with any attachments is confidential and may be subject to legal privilege. If it is not intended for you please advise by reply immediately, destroy it and do not copy, disclose or use it in any way.
__________________________________________________________________
This email has been scanned by the DMZGlobal Business Quality
Electronic Messaging Suite.
Please see http://www.dmzglobal.com/dmzmessaging.htm for details.
__________________________________________________________________

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Ravi Chemudugunta 2008-04-01 01:23:00 Re: Performance Implications of Using Exceptions
Previous Message Stephen Frost 2008-04-01 00:52:35 Re: Performance Implications of Using Exceptions