Re: cross table indexes or something?

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: cross table indexes or something?
Дата
Msg-id 200312021127.52839.josh@agliodbs.com
обсуждение исходный текст
Ответ на Re: cross table indexes or something?  (Jeremiah Jahn <jeremiah@cs.earlham.edu>)
Ответы Re: cross table indexes or something?  (Neil Conway <neilc@samurai.com>)
Re: cross table indexes or something?  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Список pgsql-performance
Jeremiah,

> Thanks to all, I had already run analyze.  But the STATISTICS setting
> seems to have worked. I'm just not sure what it did..? Would anyone care
> to explain.

The STATISTICS setting improves the granularity of statistics kept by the
query planner on that column; increasing the granularity (i.e. more random
samples) can significantly improve things in cases where you have data whose
distribution is significantly skewed.    Certainly whenever you see the query
planner using a slow nestloop becuase of a bad row-return estimate, it is one
of the first things to try.

Its drawbacks are 4-fold:
1) to keep it working, you will probably need to run ANALZYE more often than
you have been;
2) these ANALYZEs will take longer, and have the annoying side effect of
flooring your CPU while they do;
3) You will have to be sure that your vacuum plan includes vacuuming the
pg_statistic table as the database superuser, as that table will be getting
updated more often.
4) Currently, pg_dump does *not* back up statistics settings.  So you will
need to save a script which does this in preparation for having to restore
your database.

Which is why the stats are set low by default.

--
Josh Berkus
Aglio Database Solutions
San Francisco

В списке pgsql-performance по дате отправления:

Предыдущее
От: Jared Carr
Дата:
Сообщение: Re: A question on the query planner
Следующее
От: Greg Stark
Дата:
Сообщение: Re: A question on the query planner