Skip site navigation (1) Skip section navigation (2)

Re: Performance Implications of Using Exceptions

From: Stephen Frost <sfrost(at)snowman(dot)net>
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:52:35
Message-ID: 20080401005235.GM4999@tamriel.snowman.net (view raw or flat)
Thread:
Lists: pgsql-performance
* 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-structures.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.

	Enjoy,

		Stephen

In response to

Responses

pgsql-performance by date

Next:From: Stephen DenneDate: 2008-04-01 00:56:35
Subject: Re: Performance Implications of Using Exceptions
Previous:From: Ravi ChemuduguntaDate: 2008-04-01 00:20:34
Subject: Performance Implications of Using Exceptions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group