Re: Weirdly pesimistic estimates in optimizer

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: Weirdly pesimistic estimates in optimizer
Дата
Msg-id 1172896564.922252.1425390979021.JavaMail.yahoo@mail.yahoo.com
обсуждение исходный текст
Ответ на Weirdly pesimistic estimates in optimizer  (David Kubečka <kubecka.dav@gmail.com>)
Список pgsql-hackers
David Kubečka <kubecka.dav@gmail.com> wrote:

> I have read the optimizer README file and also looked briefly at
> the code, but this seems to be something not related to
> particular implementation of algorithm (e.g. nested loop).
> Perhaps it's the way how cost estimates are propagated down

It could be as simple as not having tuned your cost factors to
accurately reflect the relative costs of different actions in your
environment.  If you are using the default configuration, you might
want to try a few of the adjustments that are most often needed (at
least in my experience):

cpu_tuple_cost = 0.03
random_page_cost = 2
effective_cache_size = <50% to 75% of machine RAM>
work_mem = <machine RAM * 0.25 / max_connections>

You can SET these on an individual connection, one at a time or in
combination, and EXPLAIN the query to see the effects on plan
choice.

Other advice, not all of which matches my personal experience, can
be found here:

https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server

The best thing to do is experiment with different values with your
own queries and workloads to see what most accurately models your
costs (and thus produces the fastest plans).

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Vladimir Borodin
Дата:
Сообщение: Re: pg_upgrade and rsync
Следующее
От: Jan de Visser
Дата:
Сообщение: Re: Idea: closing the loop for "pg_ctl reload"