Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1da1NZ-0008Kw-Kf for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Jul 2017 15:04:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1da1NZ-0001JN-7I for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Jul 2017 15:04:09 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1da1NX-0001Gt-8J for pgsql-hackers@postgresql.org; Tue, 25 Jul 2017 15:04:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1da1NU-0007x7-L5 for pgsql-hackers@postgresql.org; Tue, 25 Jul 2017 15:04:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v6PF43jt007088; Tue, 25 Jul 2017 11:04:03 -0400 From: Tom Lane To: Tomas Vondra cc: pgsql-hackers@postgresql.org Subject: Re: VACUUM and ANALYZE disagreeing on what reltuples means In-reply-to: <3d250597-384e-c5f4-7533-b513e366888f@2ndquadrant.com> References: <16db4468-edfa-830a-f921-39a50498e77e@2ndquadrant.com> <19990.1500936945@sss.pgh.pa.us> <3d250597-384e-c5f4-7533-b513e366888f@2ndquadrant.com> Comments: In-reply-to Tomas Vondra message dated "Tue, 25 Jul 2017 13:33:28 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7085.1500995043.1@sss.pgh.pa.us> Date: Tue, 25 Jul 2017 11:04:03 -0400 Message-ID: <7087.1500995043@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Tomas Vondra writes: > On 7/25/17 12:55 AM, Tom Lane wrote: >> I think the planner basically assumes that reltuples is the live >> tuple count, so maybe we'd better change VACUUM to get in step. > Attached is a patch that (I think) does just that. The disagreement was > caused by VACUUM treating recently dead tuples as live, while ANALYZE > treats both of those as dead. > At first I was worried that this will negatively affect plans in the > long-running transaction, as it will get underestimates (due to > reltuples not including rows it can see). But that's a problem we > already have anyway, you just need to run ANALYZE in the other session. This definitely will have some impact on plans, at least in cases where there's a significant number of unvacuumable dead tuples. So I think it's a bit late for v10, and I wouldn't want to back-patch at all. Please add to the next commitfest. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers