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

From: ZEUGSWETTER Andreas IZ5 <Andreas(dot)Zeugswetter(at)telecom(dot)at>
To: "'Jan Wieck'" <jwieck(at)debis(dot)com>, tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: hackers(at)postgreSQL(dot)org
Subject: AW: AW: [HACKERS] create index updates nrows statistics
Date: 1999-05-26 07:58:44
Message-ID: 219F68D65015D011A8E000006F8590C60267B37A@sdexcsrv1.f000.d0188.sd.spardat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 0
2. set relpages=2 and a calculated reltuples 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 1999-05-26 08:25:43 6.5 cvs: weird crashes
Previous Message Jan Wieck 1999-05-26 07:43:29 Re: AW: [HACKERS] create index updates nrows statistics