pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeremy Harris <jgh@wizmail.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: Optimizer showing wrong rows in plan
Date: Sun, 28 Mar 2010 13:37:34 -0400
Message-ID: <24446.1269797854@sss.pgh.pa.us> (raw)
In-Reply-To: <4BAF8D1D.2050109@wizmail.org>
References: <645d9d71003272351x766707c7sadde9aa77bc1c0d3@mail.gmail.com>
	<e4edc9361003280002o627b710dhe89c98c18b5d1db3@mail.gmail.com>
	<645d9d71003280011q6cf2c6d6p7279605e6e0b4235@mail.gmail.com>
	<e4edc9361003280029v7174f84bo72d073aced772206@mail.gmail.com>
	<645d9d71003280033l16069edcp45d9bbb0e7ed5517@mail.gmail.com>
	<22618.1269793661@sss.pgh.pa.us>
	<4BAF8D1D.2050109@wizmail.org>

Jeremy Harris <jgh@wizmail.org> writes:
> On 03/28/2010 05:27 PM, Tom Lane wrote:
>> This is intentional: the size estimates for a never-yet-analyzed
>> table are *not* zero.  This is because people frequently create and load
>> up a table and then immediately query it without an explicit ANALYZE.

> Does the creation of an index also populate statistics?

IIRC, it will set the relpages/reltuples counts (though not any
more-complex statistics); but only if the table is found to not be
completely empty.  Again, this is a behavior designed with common
usage patterns in mind, to not set relpages/reltuples to zero on a
table that's likely to get populated shortly.

			regards, tom lane



view thread (15+ messages)  latest in thread

Message-ID: <24446.1269797854@sss.pgh.pa.us>
Permalink:  ../24446.1269797854@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24446.1269797854@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jgh@wizmail.org
  Subject: Re: Optimizer showing wrong rows in plan
  In-Reply-To: <24446.1269797854@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox