From: Stephen Frost <sfrost@snowman.net>
To: Ravi Chemudugunta <chemuduguntar@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Performance Implications of Using Exceptions
Date: Mon, 31 Mar 2008 20:52:35 -0400
Message-ID: <20080401005235.GM4999@tamriel.snowman.net> (raw)
In-Reply-To: <7a4208ef0803311720s1dac8362gff2477d3dc534968@mail.gmail.com>
References: <7a4208ef0803311720s1dac8362gff2477d3dc534968@mail.gmail.com>
* Ravi Chemudugunta (chemuduguntar@gmail.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
Attachments:
signature.asc (application/pgp-signature, 188B) download
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: sfrost@snowman.net, chemuduguntar@gmail.com
Subject: Re: Performance Implications of Using Exceptions
In-Reply-To: <20080401005235.GM4999@tamriel.snowman.net>
* 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