Re: slow query execution

From: Trigve Siver <trigves(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: slow query execution
Date: 2007-05-30 18:08:02
Message-ID: 210031.38017.qm@web52704.mail.re2.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>----- Original Message ----
>From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
>To: pgsql-sql(at)postgresql(dot)org
>Sent: Wednesday, May 30, 2007 7:39:18 PM
>Subject: Re: [SQL] slow query execution
>
>On Wed, May 30, 2007 at 10:03:16AM -0700, Trigve Siver wrote:
>> Hi, Thanks for reply, As you have mentioned I need to get row
>> numbers for my query, so when I make some other query with same
>> data I will know which row number has a particular ID.
>
>Oh, wait. If _that's_ your plan, then this will never work. The
>data could change, and your row numbers would come out wrong.
>What do you need "row numbers" for anyway? The very idea is inimical
>to SQL, because the data is fundamentally unordered.

I want to do it only for some queries. So when I need query like that "SELECT * from t1"
I need to add row_numbers there. So I will have "query with row_numbers" (where row_numbers
are row numbers of my virtual list view). Then when I perform search I also get row_numbers for IDs of search result and I can highlight items in my list view. I haven't found other solution that met my requirements.

I want also do it with cursors.

[...]

>I think there's some nifty way to get generate_series to do this too,
>but I don't know it offhand (generating row numbers sounds to me like
>a bad idea, so I don't do it).

I have tried with generate_series but without success.

thanks

Trigve


____________________________________________________________________________________Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2007-05-30 18:30:32 Re: slow query execution
Previous Message Andrew Sullivan 2007-05-30 17:39:18 Re: slow query execution