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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nowak Micha*<michal.nowak@xxxxxx> 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

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux