Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eDZTb-00038i-Q4 for pgsql-performance@arkaria.postgresql.org; Sat, 11 Nov 2017 17:21:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eDZTb-00043v-7A for pgsql-performance@arkaria.postgresql.org; Sat, 11 Nov 2017 17:21:51 +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 1eDZRj-0005Fz-Ds for pgsql-performance@postgresql.org; Sat, 11 Nov 2017 17:19:55 +0000 Received: from mail-io0-x235.google.com ([2607:f8b0:4001:c06::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eDZRc-0007MU-ES for pgsql-performance@postgresql.org; Sat, 11 Nov 2017 17:19:54 +0000 Received: by mail-io0-x235.google.com with SMTP id n79so5750932ion.3 for ; Sat, 11 Nov 2017 09:19:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UooUlCa5/zbv/QEbKh5nKrpsSx5xOYJpKSm9rmfjEOU=; b=Kcs3/nI8KPy3RoFq45DfU1BQthS2VSEbBzx7JuzTRPgfykEUzk1iJrJs2nclpY+Hwa lIsp48f0aXMtp0lwYKciZfcfWJmMAsA+NBu0NSN4LLi8JAVB69lW/Uo7RYfn+Jpwbbws SOKfpBtycRaEjgjQ9quRK8W/EMvLxcEjf4Xh27t6WaWnb71gkCF7WOSp9Jccf6e1AqEn 9rlU1E2U0n0sEcBvqKcebHQcLLFMeTIzzcAX0xObHZYRJyzg5Pf5nhlg+ttgPRxQ3XVn YG2V+d201YHow628E7DpkBifMHulsWbL5UdZE5w8RxBUGvZXPzDBwWkPWtDwWg17SPvd 2SNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UooUlCa5/zbv/QEbKh5nKrpsSx5xOYJpKSm9rmfjEOU=; b=Gc7tc5Qe0u83ROfx+x9gkc7QL/S6HpF7ZrBeN9CjmwvbcbVpTwtB9Z7kTGvXSMxajX 9AI13qm2Nsuy1AITRgnsNRmowDtUw0zjPoEklUQLC1kbj/7awMXJ7vdAVbQHreUhnP47 4iKxUAtZMG6qqhIwFOlgumNxk6DpP0DEZIV1fFJu+lAK4VvpeMo1rgGpjRyuGqmjPbF6 hlZevhKb2CmXS632lyZLs3X6qIELeG9PRT1Znn+qpHNYLtcNBKgByNMHkgUhtFPelhE/ MXTNGXkRZBIShf0FSSHbE6xJd8TPXJGBRtAlwg0BfV6SM6LaEk9QLhL0d+PbWtfVoZoS q6Iw== X-Gm-Message-State: AJaThX6zE+f35p6gyii4UdCWRwwEqHxld5OXkmpTpHQGNmkInrVprv2t 8F+Q2hYSU2B1D5FT7Ucv5QdpEg0Vr80= X-Google-Smtp-Source: AGs4zMana0zl1T/Cp/Zgj3waf72nVG0zzHmt8C7QX099srUwrsn+uh7GHBdYsLKMe/cVv/wvfP39Xw== X-Received: by 10.107.69.14 with SMTP id s14mr4713023ioa.113.1510420786651; Sat, 11 Nov 2017 09:19:46 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id h20sm5661564iob.65.2017.11.11.09.19.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Nov 2017 09:19:46 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 430C980102B; Sat, 11 Nov 2017 11:19:45 -0600 (CST) Date: Sat, 11 Nov 2017 11:19:45 -0600 From: Justin Pryzby To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: overestimate on empty table Message-ID: <20171111171945.GA2167@telsasoft.com> References: <20171110204043.GS8563@telsasoft.com> <9772.1510348781@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9772.1510348781@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) 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 On Fri, Nov 10, 2017 at 04:19:41PM -0500, Tom Lane wrote: > Justin Pryzby writes: > > (or, the opposite of the more common problem) > > As the queued_alters table is typically empty (and autoanalyzed with > > relpages=0), I see "why": > > > ./src/backend/optimizer/util/plancat.c > > | if (curpages < 10 && > > | rel->rd_rel->relpages == 0 && > > | !rel->rd_rel->relhassubclass && > > | rel->rd_rel->relkind != RELKIND_INDEX) > > | curpages = 10; > > So I'm sure you read the comment above that, too. > One idea is to say that relpages = reltuples = 0 is only the state that > 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==0, and make VACUUM/ANALYZE instead set only reltuples=1, since that's already done at costsize.c: clamp_row_est() and therefor no additional confusion? Justin -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance