Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcGZK-0005RF-2v for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Nov 2020 23:27:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kcGZI-0003PE-Oy for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Nov 2020 23:27:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcGZI-0003Oe-Hj for pgsql-hackers@lists.postgresql.org; Mon, 09 Nov 2020 23:27:24 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcGZF-0001Jn-JQ for pgsql-hackers@lists.postgresql.org; Mon, 09 Nov 2020 23:27:23 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1kcGZE-0003pD-LW; Mon, 09 Nov 2020 18:27:20 -0500 Date: Mon, 9 Nov 2020 18:27:20 -0500 From: Bruce Momjian To: Nikolay Samokhvalov Cc: fabriziomello@gmail.com, PostgreSQL Hackers Subject: Re: Add important info about ANALYZE after create Functional Index Message-ID: <20201109232720.GA8930@momjian.us> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2oS5YaxWCcQjTEyO" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --2oS5YaxWCcQjTEyO Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Tue, Oct 27, 2020 at 12:12:00AM -0700, Nikolay Samokhvalov wrote: > On Mon, Oct 26, 2020 at 3:08 PM Fabrízio de Royes Mello < > fabriziomello@gmail.com> wrote: > > Would be nice if add some information about it into our docs but not sure > where. I'm thinking about: > - doc/src/sgml/ref/create_index.sgml > - doc/src/sgml/maintenance.sgml (routine-reindex) > > > Attaching the patches for the docs, one for 11 and older, and another for 12+ > (which have REINDEX CONCURRENTLY not suffering from lack of ANALYZE). > > I still think that automating is the right thing to do but of course, it's a > much bigger topic that a quick fix dor the docs. I see REINDEX CONCURRENTLY was fixed in head, but the docs didn't get updated to mention the need to run ANALYZE or wait for autovacuum before expression indexes can be fully used by the optimizer. Instead of putting this mention in the maintenance section, I thought the CREATE INDEX page make more sense, since it is more of a usability issue, rather than "why use expression indexes". Patch attached, which I plan to apply to all supported branches. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee --2oS5YaxWCcQjTEyO Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="expindex.diff" diff --git a/doc/src/sgml/ref/create_index.sgml b/doc/src/sgml/ref/create_index.sgml new file mode 100644 index 749db28..48c42db *** a/doc/src/sgml/ref/create_index.sgml --- b/doc/src/sgml/ref/create_index.sgml *************** Indexes: *** 746,751 **** --- 746,761 ---- + The 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 ANALYZE or wait for + the autovacuum daemon to analyze + the table to generate statistics about new expression indexes. + + + For most index methods, the speed of creating an index is dependent on the setting of . Larger values will reduce the time needed for index creation, so long --2oS5YaxWCcQjTEyO--