Re: Query with order by and limit is very slow - wrong index used - Mailing list pgsql-performance

From Kevin Grittner
Subject Re: Query with order by and limit is very slow - wrong index used
Date
Msg-id 4E8B51730200002500041A45@gw.wicourts.gov
Whole thread Raw
In response to Re: Query with order by and limit is very slow - wrong index used  (Nowak Michał <michal.nowak@me.com>)
List 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 by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: : PG9.0 - Checkpoint tuning and pg_stat_bgwriter
Next
From: Venkat Balaji
Date:
Subject: Re: : PG9.0 - Checkpoint tuning and pg_stat_bgwriter