From: | "Zeugswetter Andreas SB SD" <ZeugswetterA(at)spardat(dot)at> |
---|---|
To: | "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "mlw" <markw(at)mohawksoft(dot)com>, <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Doug McNaught" <doug(at)wireboard(dot)com>, "Reiner Dassing" <dassing(at)wettzell(dot)ifag(dot)de>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Index of a table is not used (in any case) |
Date: | 2001-10-25 10:04:33 |
Message-ID: | 46C15C39FEB2C44BA555E356FBCD6FA41EB3D7@m0114.s-mxs.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> Of course the question "did you vacuum" (better, did you analyze) is
> annoying, just as the requirement to analyze is annoying in the first
> place, but unless someone designs a better query planner it
> will have to do. The reason why we always ask that question first is
> that people invariantly have not analyzed.
I think it is also not allways useful to ANALYZE. There are applications
that choose optimal plans with only the rudimentary statistics VACUUM
creates. And even such that use optimal plans with only the default
statistics in place.
Imho one of the biggest sources for problems is people creating new
indexes on populated tables when the rest of the db/table has badly
outdated statistics or even only default statistics in place.
In this situation the optimizer is badly misguided, because it now
sees completely inconsistent statistics to work on.
(e.g. old indexes on that table may seem way too cheap compared
to table scan)
I would thus propose a more distinguished approach of writing
the statistics gathered during "create index" to the system tables.
Something like:
if (default stats in place)
write defaults
else if (this is the only index)
write gathered statistics
else
write only normalized statistics for index
(e.g. index.reltuples = table.reltuples;
index.relpages = (index.gathered.relpages *
table.relpages / table.gathered.relpages)
Andreas
From | Date | Subject | |
---|---|---|---|
Next Message | Gabor Csuri | 2001-10-25 12:01:14 | Index not used ! Why? |
Previous Message | Lincoln Yeoh | 2001-10-25 08:56:29 | Re: storing binary data |