Thread: Performance of plpgsql with exception handlers

Performance of plpgsql with exception handlers

From
"Walker, Jed S"
Date:

The documentation states "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."

Our application developers would like to get back a simple code ( a number) for any error that indicates what it is, and possibly a message. So, as we would with Oracle we wanted to code in exception handlers to do this, but the documenation has us concerned. Is putting exception handlers into the pgsql code really a big performance hit?

Thanks,

      Jed S. Walker

Re: Performance of plpgsql with exception handlers

From
Tom Lane
Date:
"Walker, Jed S" <Jed_Walker@cable.comcast.com> writes:
> ... Is putting exception
> handlers into the pgsql code really a big performance hit?

Time it and see if it bothers you.  The doc note is just there to let
people know that it isn't free; not to scare people away from using
it at all.

            regards, tom lane