Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eDZq7-0004a6-2Q for pgsql-performance@arkaria.postgresql.org; Sat, 11 Nov 2017 17:45:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eDZq6-0007WG-L4 for pgsql-performance@arkaria.postgresql.org; Sat, 11 Nov 2017 17:45:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eDZoH-0004QT-Ai for pgsql-performance@postgresql.org; Sat, 11 Nov 2017 17:43:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eDZoA-0001Wk-3o for pgsql-performance@postgresql.org; Sat, 11 Nov 2017 17:43:12 +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 vABHh4vv004001; Sat, 11 Nov 2017 12:43:04 -0500 From: Tom Lane To: Justin Pryzby cc: pgsql-performance@postgresql.org Subject: Re: overestimate on empty table In-reply-to: <20171111171945.GA2167@telsasoft.com> References: <20171110204043.GS8563@telsasoft.com> <9772.1510348781@sss.pgh.pa.us> <20171111171945.GA2167@telsasoft.com> Comments: In-reply-to Justin Pryzby message dated "Sat, 11 Nov 2017 11:19:45 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3999.1510422184.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 11 Nov 2017 12:43:04 -0500 Message-ID: <4000.1510422184@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Justin Pryzby writes: > On Fri, Nov 10, 2017 at 04:19:41PM -0500, Tom Lane wrote: >> One idea is to say that relpages =3D reltuples =3D 0 is only the state t= hat >> prevails for a freshly-created table, and that VACUUM or ANALYZE should >> always set relpages to at least 1 even if the physical size is zero. >> Dunno if that would confuse people. > What about adding && rel->rd_rel->reltuples=3D=3D0, and make VACUUM/ANALY= ZE instead > set only reltuples=3D1, since that's already done at costsize.c: clamp_ro= w_est() > and therefor no additional confusion? 1 tuple in 0 pages is a physically impossible situation, so I'm quite sure that way *would* confuse people. regards, tom lane --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance