diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-01-01 21:53:49 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-01-01 21:53:49 +0000 |
commit | 29c4ad98293e3c5cb3fcdd413a3f4904efff8762 (patch) | |
tree | 4e4eeea2655e87eca4d3d0dd97f3e2b7d5f1e032 /doc/src | |
parent | 15faca259651c065bb20e746777f5fb9eb9d50a1 (diff) |
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.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/catalogs.sgml | 4 | ||||
-rw-r--r-- | doc/src/sgml/indexam.sgml | 5 | ||||
-rw-r--r-- | doc/src/sgml/indices.sgml | 11 |
3 files changed, 10 insertions, 10 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 0acd79361bd..9f81dc209ff 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.215 2009/12/29 20:11:42 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.216 2010/01/01 21:53:48 tgl Exp $ --> <!-- Documentation of the system catalogs, directed toward PostgreSQL developers --> @@ -466,7 +466,7 @@ <entry><structfield>amsearchnulls</structfield></entry> <entry><type>bool</type></entry> <entry></entry> - <entry>Does the access method support IS NULL searches?</entry> + <entry>Does the access method support IS NULL/NOT NULL searches?</entry> </row> <row> diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml index b81cd27d313..97af5464456 100644 --- a/doc/src/sgml/indexam.sgml +++ b/doc/src/sgml/indexam.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/indexam.sgml,v 2.31 2009/07/29 20:56:17 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/indexam.sgml,v 2.32 2010/01/01 21:53:49 tgl Exp $ --> <chapter id="indexam"> <title>Index Access Method Interface Definition</title> @@ -134,7 +134,8 @@ null values. An index access method that sets <structfield>amindexnulls</structfield> may also set <structfield>amsearchnulls</structfield>, indicating that it supports - <literal>IS NULL</> clauses as search conditions. + <literal>IS NULL</> and <literal>IS NOT NULL</> clauses as search + conditions. </para> </sect1> diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml index 7801b099f22..0ab3e25e80b 100644 --- a/doc/src/sgml/indices.sgml +++ b/doc/src/sgml/indices.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/indices.sgml,v 1.79 2009/08/07 20:54:31 alvherre Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/indices.sgml,v 1.80 2010/01/01 21:53:49 tgl Exp $ --> <chapter id="indexes"> <title id="indexes-title">Indexes</title> @@ -147,8 +147,8 @@ CREATE INDEX test1_id_index ON test1 (id); Constructs equivalent to combinations of these operators, such as <literal>BETWEEN</> and <literal>IN</>, can also be implemented with - a B-tree index search. Also, an <literal>IS NULL</> condition on - an index column can be used with a B-tree index. + a B-tree index search. Also, an <literal>IS NULL</> or <literal>IS NOT + NULL</> condition on an index column can be used with a B-tree index. </para> <para> @@ -180,8 +180,7 @@ CREATE INDEX test1_id_index ON test1 (id); Hash indexes can only handle simple equality comparisons. The query planner will consider using a hash index whenever an indexed column is involved in a comparison using the - <literal>=</literal> operator. (Hash indexes do not support - <literal>IS NULL</> searches.) + <literal>=</literal> operator. The following command is used to create a hash index: <synopsis> CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable> USING hash (<replaceable>column</replaceable>); @@ -1025,7 +1024,7 @@ SELECT am.amname AS index_method, real statistics, some default values are assumed, which are almost certain to be inaccurate. Examining an application's index usage without having run <command>ANALYZE</command> is - therefore a lost cause. + therefore a lost cause. See <xref linkend="vacuum-for-statistics" endterm="vacuum-for-statistics-title"> and <xref linkend="autovacuum" endterm="autovacuum-title"> for more information. </para> |