Обсуждение: AW: AW: [HACKERS] create index updates nrows statistics

Поиск
Список
Период
Сортировка

AW: AW: [HACKERS] create index updates nrows statistics

От
ZEUGSWETTER Andreas IZ5
Дата:
Jan wrote:
>     From memory not verified:
> 
>     Doesn't CREATE INDEX update pg_statistics? 
> 
No.

> I think it does so
> the faked statistics only cause different joins to happen  as
> long  as  there  is no index created immediately after CREATE
> TABLE (HASHJOIN vs. NESTLOOP).
> 
No, create index on a newly created table does:1. set reltuples and relpages of the table to 02. set relpages=2 and a
calculatedreltuples of 2048 or below   on the index depending on how many multy columns
 

This leads to a rather strange state where reltuples of table <
reltuples of index. It forces seq scans on update and select
of single table. (see E. Mergl's update problem)

Andreas