Peter Eisentraut <peter.eisentr...@2ndquadrant.com> writes:
> Is there a preferred method to select between using elog() and
> errmsg_internal()?

ereport(... errmsg_internal() ...) can be a win for debug messages that
are in hot code paths, because the test for whether the message will
get printed is able to short-circuit more work.  In particular,
if you have moderately expensive functions like syscache lookups in
the argument list of elog(), I believe those functions get evaluated
even if we end up not printing anything.  ereport() skips the
arg-list evaluation in such cases.

But if that doesn't seem very relevant, I'd tend to go for elog()
just because it's less typing.

                        regards, tom lane


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

Reply via email to