Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: slow query execution



>----- 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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group