AW: AW: [HACKERS] create index updates nrows statistics - Mailing list pgsql-hackers

From ZEUGSWETTER Andreas IZ5
Subject AW: AW: [HACKERS] create index updates nrows statistics
Date
Msg-id 219F68D65015D011A8E000006F8590C60267B37A@sdexcsrv1.f000.d0188.sd.spardat.at
Whole thread Raw
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: jwieck@debis.com (Jan Wieck)
Date:
Subject: Re: AW: [HACKERS] create index updates nrows statistics
Next
From: Oleg Bartunov
Date:
Subject: 6.5 cvs: weird crashes