Re: LIMIT between some column

From: Uros Gruber <urosr(at)sir-mag(dot)com>
To: pgsql-general-owner(at)postgresql(dot)org, "Joel Burton" <joel(at)joelburton(dot)com>
Cc: "Uros Gruber" <uros(at)sir-mag(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: LIMIT between some column
Date: 2002-05-19 16:15:55
Message-ID: 19424628413.20020519181555@sir-mag.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

Sunday, May 19, 2002, 5:47:08 PM, you wrote:
>>
>> I tried this and it works, but i don't like this. because
>> it's to slow and i have to use ids like i do it in example. I
>> want to have something that i'm not forced to use ids like
>> here.

JB> You don't need IDs per se, but for this to work, you do need _something_ you
JB> can order these by -- a datetime or money amount or something (would your
JB> "name" column do?) -- otherwise, how are you choosing which are the top 3
JB> that you want to see? Randomly?

I have some colum name on which i want to order.

JB> As for speed: yep, it's slow. Correlated subqueries always are. An index on
JB> parent will help a lot, as will an index on whatever the comparison field is
JB> (id in my example). Or, possibly, someone else may be able to suggest a
JB> faster way, but I'm not seeing one right now.

I try to use indexes but it's still to slow. I'm faster if i
select all and then cut those rows in PHP.

>> especialy if i move some categories or delete any. This
>> method don't work anymore.

bye Uros

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-05-19 17:31:25 Re: Walking a view to find all source tables
Previous Message Joel Burton 2002-05-19 15:47:08 Re: LIMIT between some column