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 1k3ny8-0002cM-5O for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Aug 2020 22:02:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k3ny6-0002Ui-QY for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Aug 2020 22:02:34 +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 1k3ny6-0002Tx-JU for pgsql-hackers@lists.postgresql.org; Thu, 06 Aug 2020 22:02:34 +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 1k3ny4-0006OH-9v for pgsql-hackers@lists.postgresql.org; Thu, 06 Aug 2020 22:02:34 +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 076M2QPU2648864; Thu, 6 Aug 2020 18:02:26 -0400 From: Tom Lane To: Andres Freund cc: Robert Haas , Alvaro Herrera , James Coleman , pgsql-hackers , Simon Riggs Subject: Re: PROC_IN_ANALYZE stillborn 13 years ago In-reply-to: <20200806214541.4lyyzekds65hrlcq@alap3.anarazel.de> References: <20200805021435.GA9523@alvherre.pgsql> <20200805235549.GA8118@alvherre.pgsql> <20200806010711.mzvu36zy25xer33t@alap3.anarazel.de> <2637311.1596739058@sss.pgh.pa.us> <2638833.1596741087@sss.pgh.pa.us> <20200806214541.4lyyzekds65hrlcq@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Thu, 06 Aug 2020 14:45:41 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2648862.1596751346.1@sss.pgh.pa.us> Date: Thu, 06 Aug 2020 18:02:26 -0400 Message-ID: <2648863.1596751346@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > In fact using conceptually like a new snapshot for each sample tuple > actually seems like it'd be somewhat of an improvement over using a > single snapshot. Dunno, that feels like a fairly bad idea to me. It seems like it would overemphasize the behavior of whatever queries happened to be running concurrently with the ANALYZE. I do follow the argument that using a single snapshot for the whole ANALYZE overemphasizes a single instant in time, but I don't think that leads to the conclusion that we shouldn't use a snapshot at all. Another angle that would be worth considering, aside from the issue of whether the sample used for pg_statistic becomes more or less representative, is what impact all this would have on the tuple count estimates that go to the stats collector and pg_class.reltuples. Right now, we don't have a great story at all on how the stats collector's count is affected by combining VACUUM/ANALYZE table-wide counts with the incremental deltas reported by transactions happening concurrently with VACUUM/ANALYZE. Would changing this behavior make that better, or worse, or about the same? regards, tom lane