Re: From Simple to Complex - Mailing list pgsql-performance

From Scott Marlowe
Subject Re: From Simple to Complex
Date
Msg-id CAOR=d=3x8o1k+7-jKs_F20RR8FiUk=pdFZU7cg+CM=PJUwEJFg@mail.gmail.com
Whole thread Raw
In response to Re: From Simple to Complex  (Alessandro Gagliardi <alessandro@path.com>)
List pgsql-performance
On Wed, Feb 1, 2012 at 11:48 AM, Alessandro Gagliardi
<alessandro@path.com> wrote:
> LIMIT 65536; Total query runtime: 14846 ms.
> - http://explain.depesz.com/s/I3E
> LIMIT 69632: Total query runtime: 80141 ms.
> - http://explain.depesz.com/s/9hp
>
> So it looks like when the limit crosses a certain threshold (somewhere north
> of 2^16), Postgres decides to do a Seq Scan instead of an Index Scan.
> I've already lowered random_page_cost to 2. Maybe I should lower it to 1.5?
> Actually 60K should be plenty for my purposes anyway.

It's important to set random_page_cost according to more than just one
query, but yeah, at this point it's likely a good idea to set it
closer to 1.0.  You're on heroku right?  Something closer to 1.0 is
likely called for if so.  1.2 to 1.4 or so.

If you've got other queries you can test the change on all the better.

pgsql-performance by date:

Previous
From: Alessandro Gagliardi
Date:
Subject: Re: From Simple to Complex
Next
From: Bob Lunney
Date:
Subject: Re: From Simple to Complex