Skip site navigation (1) Skip section navigation (2)

Re: Optimizer showing wrong rows in plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeremy Harris <jgh(at)wizmail(dot)org>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Optimizer showing wrong rows in plan
Date: 2010-03-28 17:37:34
Message-ID: 24446.1269797854@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
Jeremy Harris <jgh(at)wizmail(dot)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

In response to

Responses

pgsql-performance by date

Next:From: C├ędric VillemainDate: 2010-03-28 21:04:24
Subject: Re: Forcing index scan on query produces 16x faster
Previous:From: Jeremy HarrisDate: 2010-03-28 17:08:45
Subject: Re: Optimizer showing wrong rows in plan

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group