postgresql/src/include/commands
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
..
alter.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
async.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
cluster.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
collationcmds.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
comment.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
conversioncmds.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
copy.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
createas.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
dbcommands.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
defrem.h Avoid repeated name lookups during table and index DDL. 2014-02-17 09:33:31 -05:00
discard.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
event_trigger.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
explain.h Improve performance of EXPLAIN with large range tables. 2015-01-15 13:18:16 -05:00
extension.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
lockcmds.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
matview.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
portalcmds.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
prepare.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
proclang.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
schemacmds.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
seclabel.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
sequence.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
tablecmds.h Rework 'MOVE ALL' to 'ALTER .. ALL IN TABLESPACE' 2014-08-21 19:12:00 -04:00
tablespace.h Rework 'MOVE ALL' to 'ALTER .. ALL IN TABLESPACE' 2014-08-21 19:12:00 -04:00
trigger.h Offer triggers on foreign tables. 2014-03-23 02:16:34 -04:00
typecmds.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
user.h ALTER TABLESPACE ... MOVE ... OWNED BY 2014-01-23 23:52:40 -05:00
vacuum.h Test IsInTransactionChain, not IsTransactionBlock, in vac_update_relstats. 2014-10-30 13:04:13 -04:00
variable.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
view.h Update copyright for 2014 2014-01-07 16:05:30 -05:00