Re: Slow query when using ORDER BY *and* LIMIT

From: Michael Viscuso <michael(dot)viscuso(at)getcarbonblack(dot)com>
To: davidsarmstrong <dsatemp-1(at)yahoo(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow query when using ORDER BY *and* LIMIT
Date: 2011-10-15 21:09:24
Message-ID: CA+Z27QSQD1uCFGkh+Nyg3eDgEuGEA=Su4gp3sGpmt0D63GzC5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Dave,

Since I control the application that was performing the query and I've
separated my data into daily partitioned tables (which enforced my order by
clause on a macro-level), I took Stephen's advice and implemented the nested
loop over each daily table from within the application versus having
Postgres figure it out for me. Sorry I don't have a better answer for you.

Mike

On Thu, Oct 13, 2011 at 3:34 PM, davidsarmstrong <dsatemp-1(at)yahoo(dot)com>wrote:

> I'm running into the same problem. I removed the limit and it was fine. I
> guess I could have removed the order by as well but it doesn't help if you
> really need both.
>
> Have you found any more information on this?
>
> Thanks!
>
> Dave (Armstrong)
>
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/Slow-query-when-using-ORDER-BY-and-LIMIT-tp4555260p4900348.html
> Sent from the PostgreSQL - performance mailing list archive at Nabble.com.
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Robins Tharakan 2011-10-17 06:28:47 Bad plan by Planner (Already resolved?)
Previous Message Josh Berkus 2011-10-14 18:19:38 Re: Tablespace files deleted automatically.