Re: Row estimates for empty tables

Christophe Pettus <xof@thebuild.com>

From: Christophe Pettus <xof@thebuild.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, David Rowley <dgrowleyml@gmail.com>, postgre <pgsql-general@lists.postgresql.org>
Date: 2020-07-24T21:54:21Z
Lists: pgsql-hackers, pgsql-general

> On Jul 24, 2020, at 14:09, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Rather than adding another pg_class column, I'm tempted to say that
> vacuum/analyze should set relpages to a minimum of 1, even if the
> relation has zero pages. 

If there's not an issue about relpages != actual pages on disk, that certain seems straight-forward, and no *more* hacky than the current situation.

--
-- Christophe Pettus
   xof@thebuild.com




Commits

  1. Redefine pg_class.reltuples to be -1 before the first VACUUM or ANALYZE.