Re: Query with order by and limit is very slow - wrong index used

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: Query with order by and limit is very slow - wrong index used
Дата
Msg-id 4E8B51730200002500041A45@gw.wicourts.gov
обсуждение исходный текст
Ответ на Re: Query with order by and limit is very slow - wrong index used  (Nowak Michał <michal.nowak@me.com>)
Список pgsql-performance
Nowak Micha*<michal.nowak@me.com> wrote:

> Lowering random_page_cost didn't help -- I've tried values 2.0 and
> 1.5.

First off, I don't remember you saying how much RAM is on the
system, but be sure to set effective_cache_size to the sum of your
shared_buffers and OS cache.  I've often found that the optimizer
undervalues cpu_tuple_cost; try setting that to 0.05.  Then,
depending on how well cached the active portion of your database is,
you may want to drop your random_page_cost down close to or equal to
seq_page_cost.  If your cache hit rate is high enough, you might
want to drop *both* seq_page_cost and random_page_cost to something
as low as 0.1 or even 0.05.

The objective is to model the actual costs of your workload against
your data on your hardware.  Sometimes that takes a bit of
tinkering.

-Kevin

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: : PG9.0 - Checkpoint tuning and pg_stat_bgwriter
Следующее
От: Venkat Balaji
Дата:
Сообщение: Re: : PG9.0 - Checkpoint tuning and pg_stat_bgwriter