Re: From Simple to Complex

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Alessandro Gagliardi <alessandro(at)path(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: From Simple to Complex
Date: 2012-02-01 18:53:06
Message-ID: CAOR=d=3x8o1k+7-jKs_F20RR8FiUk=pdFZU7cg+CM=PJUwEJFg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Feb 1, 2012 at 11:48 AM, Alessandro Gagliardi
<alessandro(at)path(dot)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.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Bob Lunney 2012-02-01 19:04:04 Re: From Simple to Complex
Previous Message Gudmundur Johannesson 2012-02-01 18:50:09 Re: Index with all necessary columns - Postgres vs MSSQL