Re: [GENERAL] Catching errors inside a LOOP is causing performance issues - Mailing list pgsql-general

From Tom Lane
Subject Re: [GENERAL] Catching errors inside a LOOP is causing performance issues
Date
Msg-id 7669.1506535198@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] Catching errors inside a LOOP is causing performance issues  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: [GENERAL] Catching errors inside a LOOP is causing performanceissues  (Denisa Cirstescu <Denisa.Cirstescu@tangoe.com>)
List pgsql-general
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> ​Not sure how much detail you are looking for but the docs say this:
> "​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."
> https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

> I'm somewhat doubting "plan caching" has anything to do with this; I
> suspect its basically that there is high memory and runtime overhead to
> deal with the possibilities of needing to convert a exception into a branch
> instead of allowing it to be fatal.

Yeah, it's about the overhead of setting up and ending a subtransaction.
That's a fairly expensive mechanism, but we don't have anything cheaper
that is able to recover from arbitrary errors.
        regards, tom lane


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

pgsql-general by date:

Previous
From: Igor Polishchuk
Date:
Subject: Re: [GENERAL] Rsync to a recovering streaming replica?
Next
From: Jerry Sievers
Date:
Subject: Re: [GENERAL] WAL Archive command.