Nowak Micha*<michal(dot)nowak(at)me(dot)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