]> granicus.if.org Git - postgresql/commit
Support "x IS NOT NULL" clauses as indexscan conditions. This turns out
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 1 Jan 2010 21:53:49 +0000 (21:53 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 1 Jan 2010 21:53:49 +0000 (21:53 +0000)
commit29c4ad98293e3c5cb3fcdd413a3f4904efff8762
tree4e4eeea2655e87eca4d3d0dd97f3e2b7d5f1e032
parent15faca259651c065bb20e746777f5fb9eb9d50a1
Support "x IS NOT NULL" clauses as indexscan conditions.  This turns out
to be just a minor extension of the previous patch that made "x IS NULL"
indexable, because we can treat the IS NOT NULL condition as if it were
"x < NULL" or "x > NULL" (depending on the index's NULLS FIRST/LAST option),
just like IS NULL is treated like "x = NULL".  Aside from any possible
usefulness in its own right, this is an important improvement for
index-optimized MAX/MIN aggregates: it is now reliably possible to get
a column's min or max value cheaply, even when there are a lot of nulls
cluttering the interesting end of the index.
18 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/indexam.sgml
doc/src/sgml/indices.sgml
src/backend/access/common/scankey.c
src/backend/access/gist/gistget.c
src/backend/access/gist/gistscan.c
src/backend/access/nbtree/nbtutils.c
src/backend/executor/nodeIndexscan.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planagg.c
src/backend/utils/adt/selfuncs.c
src/include/access/skey.h
src/include/catalog/pg_am.h
src/include/nodes/relation.h
src/include/optimizer/planmain.h
src/test/regress/expected/create_index.out
src/test/regress/sql/create_index.sql