postgresql/src
Tom Lane d25192892d Improve performance of EXPLAIN with large range tables.
As of 9.3, ruleutils.c goes to some lengths to ensure that table and column
aliases used in its output are unique.  Of course this takes more time than
was required before, which in itself isn't fatal.  However, EXPLAIN was set
up so that recalculation of the unique aliases was repeated for each
subexpression printed in a plan.  That results in O(N^2) time and memory
consumption for large plan trees, which did not happen in older branches.

Fortunately, the expensive work is the same across a whole plan tree,
so there is no need to repeat it; we can do most of the initialization
just once per query and re-use it for each subexpression.  This buys
back most (not all) of the performance loss since 9.2.

We need an extra ExplainState field to hold the precalculated deparse
context.  That's no problem in HEAD, but in the back branches, expanding
sizeof(ExplainState) seems risky because third-party extensions might
have local variables of that struct type.  So, in 9.4 and 9.3, introduce
an auxiliary struct to keep sizeof(ExplainState) the same.  We should
refactor the APIs to avoid such local variables in future, but that's
material for a separate HEAD-only commit.

Per gripe from Alexey Bashtanov.  Back-patch to 9.3 where the issue
was introduced.
2015-01-15 13:18:16 -05:00
..
backend Improve performance of EXPLAIN with large range tables. 2015-01-15 13:18:16 -05:00
bin Fix broken pg_dump code for dumping comments on event triggers. 2015-01-05 19:27:06 -05:00
common Fix libpq's behavior when /etc/passwd isn't readable. 2015-01-11 12:35:47 -05:00
include Improve performance of EXPLAIN with large range tables. 2015-01-15 13:18:16 -05:00
interfaces Fix libpq's behavior when /etc/passwd isn't readable. 2015-01-11 12:35:47 -05:00
makefiles Remove USE_VPATH make variable from PGXS 2014-12-04 08:45:48 -05:00
pl Fix some functions that were declared static then defined not-static. 2015-01-12 16:08:46 -05:00
port Fix libpq's behavior when /etc/passwd isn't readable. 2015-01-11 12:35:47 -05:00
template
test Avoid unexpected slowdown in vacuum regression test. 2015-01-12 15:13:31 -05:00
timezone Add CST (China Standard Time) to our lists of timezone abbreviations. 2014-12-24 16:35:34 -05:00
tools Add pg_string_endswith as the start of a string helper library in src/common. 2015-01-03 20:54:13 +01:00
tutorial pgindent run for 9.4 2014-05-06 12:12:18 -04:00
.gitignore
bcc32.mak
DEVELOPERS
Makefile
Makefile.global.in Fix installcheck case for tap tests 2014-12-24 10:32:02 -05:00
Makefile.shlib MinGW: Include .dll extension in .def file LIBRARY commands. 2014-10-27 19:59:52 -04:00
nls-global.mk
win32.mak