pgsql: Fix performance issue in EXPLAIN (ANALYZE, TIMING OFF).

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix performance issue in EXPLAIN (ANALYZE, TIMING OFF).
Date: 2013-02-08 03:53:18
Message-ID: E1U3f1a-0007YU-Kp@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix performance issue in EXPLAIN (ANALYZE, TIMING OFF).

Commit af7914c6627bcf0b0ca614e9ce95d3f8056602bf, which added the TIMING
option to EXPLAIN, had an oversight: if the TIMING option is disabled
then control in InstrStartNode() goes through an elog(DEBUG2) call, which
typically does nothing but takes a noticeable amount of time to do it.
Tweak the logic to avoid that.

In HEAD, also change the elog(DEBUG2)'s in instrument.c to elog(ERROR).
It's not very clear why they weren't like that to begin with, but this
episode shows that not complaining more vociferously about misuse is
likely to do little except allow bugs to remain hidden.

While at it, adjust some code that was making possibly-dangerous
assumptions about flag bits being in the rightmost byte of the
instrument_options word.

Problem reported by Pavel Stehule (via Tomas Vondra).

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/0e23588e9e30150c7461303b3796274bb31b046f

Modified Files
--------------
src/backend/executor/instrument.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2013-02-08 04:32:41 pgsql: doc: Rewrite how to get the source code
Previous Message Tom Lane 2013-02-08 00:14:56 pgsql: Make contrib/btree_gist's GiST penalty function a bit saner.