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 1kXqlW-00042X-Gg for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Oct 2020 19:05:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kXqlV-0002Qk-Gc for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Oct 2020 19:05:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXqlV-0002Qd-9x for pgsql-hackers@lists.postgresql.org; Wed, 28 Oct 2020 19:05:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXqlT-0004Xf-8O for pgsql-hackers@lists.postgresql.org; Wed, 28 Oct 2020 19:05:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 09SJ5dXB1442678; Wed, 28 Oct 2020 15:05:39 -0400 From: Tom Lane To: Tomas Vondra cc: "David G. Johnston" , =?utf-8?B?RmFicsOtemlv?= Mello , PostgreSQL Hackers Subject: Re: Add important info about ANALYZE after create Functional Index In-reply-to: <20201028185538.fzux2lhim472h46o@development> References: <20201028185538.fzux2lhim472h46o@development> Comments: In-reply-to Tomas Vondra message dated "Wed, 28 Oct 2020 19:55:38 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1442676.1603911939.1@sss.pgh.pa.us> Date: Wed, 28 Oct 2020 15:05:39 -0400 Message-ID: <1442677.1603911939@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tomas Vondra writes: > On Mon, Oct 26, 2020 at 03:46:10PM -0700, David G. Johnston wrote: >> It would seem preferable to call the lack of auto-analyzing after these >> operations a bug and back-patch a fix that injects an analyze side-effect >> just before their completion. It doesn't have to be smart either, >> analyzing things even if the created (or newly validated) index doesn't >> have statistics of its own isn't a problem in my book. > I agree the lack of stats may be quite annoying and cause issues, but my > guess is the chances of backpatching such change are about 0.000001%. We > have a usable 'workaround' for this - manual analyze. This doesn't seem clearly different from any other situation where auto-analyze doesn't react fast enough to suit you. I would not call it a bug, at least not without a wholesale redefinition of how auto-analyze is supposed to work. As a close analogy, we don't make any effort to force an immediate auto-analyze after CREATE STATISTICS. I don't see anything in the CREATE STATISTICS man page pointing that out, either. But there's probably room for "Notes" entries about it in both places. regards, tom lane