postgresql/src
Tom Lane a4523c5aa5 Improve planning of btree index scans using ScalarArrayOpExpr quals.
Since we taught btree to handle ScalarArrayOpExpr quals natively (commit
9e8da0f757), the planner has always included
ScalarArrayOpExpr quals in index conditions if possible.  However, if the
qual is for a non-first index column, this could result in an inferior plan
because we can no longer take advantage of index ordering (cf. commit
807a40c551).  It can be better to omit the
ScalarArrayOpExpr qual from the index condition and let it be done as a
filter, so that the output doesn't need to get sorted.  Indeed, this is
true for the query introduced as a test case by the latter commit.

To fix, restructure get_index_paths and build_index_paths so that we
consider paths both with and without ScalarArrayOpExpr quals in non-first
index columns.  Redesign the API of build_index_paths so that it reports
what it found, saving useless second or third calls.

Report and patch by Andrew Gierth (though rather heavily modified by me).
Back-patch to 9.2 where this code was introduced, since the issue can
result in significant performance regressions compared to plans produced
by 9.1 and earlier.
2014-10-26 16:12:22 -04:00
..
backend Improve planning of btree index scans using ScalarArrayOpExpr quals. 2014-10-26 16:12:22 -04:00
bin Forgot #include "pg_getopt.h", now that pg_controldata uses getopt. 2014-10-24 20:41:21 +03:00
common Small message fixes 2014-08-09 00:07:00 -04:00
include Add native compiler and memory barriers for solaris studio. 2014-10-25 11:11:39 +02:00
interfaces Ensure libpq reports a suitable error message on unexpected socket EOF. 2014-10-22 18:41:44 -04:00
makefiles MinGW: Use -static-libgcc when linking a DLL. 2014-10-21 22:55:47 -04:00
pl Translation updates 2014-10-05 23:23:50 -04:00
port Work around Windows locale name with non-ASCII character. 2014-10-24 21:10:13 +03:00
template Remove Alpha and Tru64 support. 2014-06-28 21:46:15 +02:00
test Improve planning of btree index scans using ScalarArrayOpExpr quals. 2014-10-26 16:12:22 -04:00
timezone Support timezone abbreviations that sometimes change. 2014-10-16 15:22:10 -04:00
tools Add valgrind suppression for padding bytes in twophase records. 2014-09-01 15:59:44 +02:00
tutorial Adjust blank lines around PG_MODULE_MAGIC defines, for consistency 2014-07-10 14:02:08 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Fix TAP tests with Perl 5.8 2014-10-26 09:47:01 -04:00
Makefile.shlib MinGW: Use -static-libgcc when linking a DLL. 2014-10-21 22:55:47 -04:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
nls-global.mk Setup error context callback for transaction lock waits 2014-03-19 15:10:36 -03:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00