postgresql/src/include
Tom Lane a17da19ed9 Invent a "one-shot" variant of CachedPlans for better performance.
SPI_execute() and related functions create a CachedPlan, execute it once,
and immediately discard it, so that the functionality offered by
plancache.c is of no value in this code path.  And performance measurements
show that the extra data copying and invalidation checking done by
plancache.c slows down simple queries by 10% or more compared to 9.1.
However, enough of the SPI code is shared with functions that do need plan
caching that it seems impractical to bypass plancache.c altogether.
Instead, let's invent a variant version of cached plans that preserves
99% of the API but doesn't offer any of the actual functionality, nor the
overhead.  This puts SPI_execute() performance back on par, or maybe even
slightly better, than it was before.  This change should resolve recent
complaints of performance degradation from Dong Ye, Pavel Stehule, and
others.

By avoiding data copying, this change also reduces the amount of memory
needed to execute many-statement SPI_execute() strings, as for instance in
a recent complaint from Tomas Vondra.

An additional benefit of this change is that multi-statement SPI_execute()
query strings are now processed fully serially, that is we complete
execution of earlier statements before running parse analysis and planning
on following ones.  This eliminates a long-standing POLA violation, in that
DDL that affects the behavior of a later statement will now behave as
expected.

Back-patch to 9.2, since this was a performance regression compared to 9.1.
(In 9.2, place the added struct fields so as to avoid changing the offsets
of existing fields.)

Heikki Linnakangas and Tom Lane
2013-01-04 17:42:25 -05:00
..
access Tolerate timeline switches while "pg_basebackup -X fetch" is running. 2013-01-03 19:50:46 +02:00
bootstrap Fix management of pendingOpsTable in auxiliary processes. 2012-07-18 15:28:17 -04:00
catalog Fix assorted bugs in CREATE/DROP INDEX CONCURRENTLY. 2012-11-29 10:37:13 -05:00
commands Fix ALTER EXTENSION / SET SCHEMA 2012-10-31 10:48:41 -03:00
datatype Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
executor Invent a "one-shot" variant of CachedPlans for better performance. 2013-01-04 17:42:25 -05:00
foreign Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
lib Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
libpq Produce a more useful error message for over-length Unix socket paths. 2012-11-29 19:57:10 -05:00
mb Back-patch addition of pg_wchar-to-multibyte conversion functionality. 2012-07-10 16:52:36 -04:00
nodes Prevent failure when RowExpr or XmlExpr is parse-analyzed twice. 2012-12-23 14:07:31 -05:00
optimizer Fix SELECT DISTINCT with index-optimized MIN/MAX on inheritance trees. 2012-11-26 12:58:08 -05:00
parser Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
port Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
portability Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
postmaster Improve coding around the fsync request queue. 2012-07-17 16:57:10 -04:00
regex Back-patch fix for extraction of fixed prefixes from regular expressions. 2012-07-10 18:00:39 -04:00
replication syncrep.h must include xlogdefs.h 2012-08-28 10:03:37 -04:00
rewrite Prevent CREATE TABLE LIKE/INHERITS from (mis) copying whole-row Vars. 2012-06-30 16:45:27 -04:00
snowball Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
storage Don't advance checkPoint.nextXid near the end of a checkpoint sequence. 2012-12-02 15:20:03 -05:00
tcop Revert patch for taking fewer snapshots. 2012-11-26 15:55:51 -05:00
tsearch Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
utils Invent a "one-shot" variant of CachedPlans for better performance. 2013-01-04 17:42:25 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
c.h Remove leftovers of BeOS port 2012-05-14 04:50:39 +03:00
fmgr.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
funcapi.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
getaddrinfo.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
getopt_long.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
Makefile Fix server header file installation with vpath builds 2011-11-10 20:52:54 +02:00
miscadmin.h Fix management of pendingOpsTable in auxiliary processes. 2012-07-18 15:28:17 -04:00
pg_config.h.in Make configure probe for mbstowcs_l as well as wcstombs_l. 2012-08-31 14:18:02 -04:00
pg_config.h.win32 Stamp 9.2.2. 2012-12-03 15:16:10 -05:00
pg_config_manual.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
pg_trace.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
pgstat.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
pgtime.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
port.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
postgres.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
postgres_ext.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
postgres_fe.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
rusagestub.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
windowapi.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00