Re: Optimizer showing wrong rows in plan

От: Tom Lane
Тема: Re: Optimizer showing wrong rows in plan
Дата: ,
Msg-id: 24446.1269797854@sss.pgh.pa.us
(см: обсуждение, исходный текст)
Ответ на: Re: Optimizer showing wrong rows in plan  (Jeremy Harris)
Ответы: Re: Optimizer showing wrong rows in plan  (Tadipathri Raghu)
Список: pgsql-performance

Скрыть дерево обсуждения

Optimizer showing wrong rows in plan  (Tadipathri Raghu, )
 Re: Optimizer showing wrong rows in plan  (Szymon Guz, )
  Re: Optimizer showing wrong rows in plan  (Tadipathri Raghu, )
   Re: Optimizer showing wrong rows in plan  (Szymon Guz, )
    Re: Optimizer showing wrong rows in plan  (Tadipathri Raghu, )
     Re: Optimizer showing wrong rows in plan  (Tom Lane, )
      Re: Optimizer showing wrong rows in plan  (Jeremy Harris, )
       Re: Optimizer showing wrong rows in plan  (Tom Lane, )
        Re: Optimizer showing wrong rows in plan  (Tadipathri Raghu, )
         Re: Optimizer showing wrong rows in plan  (Matthew Wakeling, )
          Re: Optimizer showing wrong rows in plan  (raghavendra t, )
           Re: Optimizer showing wrong rows in plan  (Nikolas Everett, )
 Re: Optimizer showing wrong rows in plan  (Tadipathri Raghu, )
  Re: Optimizer showing wrong rows in plan  (Frank Heikens, )
  Re: Optimizer showing wrong rows in plan  (Gary Doades, )

Jeremy Harris <> 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


В списке pgsql-performance по дате сообщения:

От: Cédric Villemain
Дата:
Сообщение: Re: Forcing index scan on query produces 16x faster
От: Greg Smith
Дата:
Сообщение: Re: Database size growing over time and leads to performance impact