Re: LIMIT between some column - Mailing list pgsql-general

From Uros Gruber
Subject Re: LIMIT between some column
Date
Msg-id 19424628413.20020519181555@sir-mag.com
Whole thread Raw
In response to Re: LIMIT between some column  ("Joel Burton" <joel@joelburton.com>)
List 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


pgsql-general by date:

Previous
From: "Daniel Morgan"
Date:
Subject: ANN: Npgsql - .Net Data Provider for PostgreSQL
Next
From: david.butcher@cathaynetworks.com
Date:
Subject: inheritance and primary key contraint