docs: mention that expression indexes need analyze

Expression indexes can't benefit from pre-computed statistics on
columns.

Reported-by: Nikolay Samokhvalov

Discussion: https://postgr.es/m/CANNMO++5rw9RDA=p40iMVbMNPaW6O=S0AFzTU=KpYHRpCd1voA@mail.gmail.com

Author: Nikolay Samokhvalov, modified

Backpatch-through: 9.5
This commit is contained in:
Bruce Momjian 2020-11-12 15:00:44 -05:00
parent 52003bf3c4
commit e4b5e5f7fd

View File

@ -741,6 +741,16 @@ Indexes:
sort high</quote>, in queries that depend on indexes to avoid sorting steps. sort high</quote>, in queries that depend on indexes to avoid sorting steps.
</para> </para>
<para>
The regularly system collects statistics on all of a table's
columns. Newly-created non-expression indexes can immediately
use these statistics to determine an index's usefulness.
For new expression indexes, it is necessary to run <link
linkend="sql-analyze"><command>ANALYZE</command></link> or wait for
the <link linkend="autovacuum">autovacuum daemon</link> to analyze
the table to generate statistics about new expression indexes.
</para>
<para> <para>
For most index methods, the speed of creating an index is For most index methods, the speed of creating an index is
dependent on the setting of <xref linkend="guc-maintenance-work-mem"/>. dependent on the setting of <xref linkend="guc-maintenance-work-mem"/>.