From: | Ludwig Lim <lud_nowhere_man(at)yahoo(dot)com> |
---|---|
To: | Dawn Hollingsworth <dmh(at)airdefense(dot)net> |
Cc: | PosgreSQL Mailing List <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Table Sorting and Limit Question |
Date: | 2002-08-09 01:42:23 |
Message-ID: | 20020809014223.3100.qmail@web40009.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
--- Dawn Hollingsworth <dmh(at)airdefense(dot)net> wrote:
>
>
> Currently we have a table with a sequence number( id
> ) as a primary key,
> a date field which is indexed and several other
> columns. The user
> interface allows the user to sort the data by date
> and limits the result
> set to 100 rows.
>
> The question is:
> The user interface needs the capability to sort the
> table by date but
> pull out the hundred row set that contains id
> say...542 for example.
>
> What would be the best way to do this taking into
> account this table is
> several hundred thousand rows?
try also to index the id.
Try :
Select *
from <table>
where id=<id>
order by date
limit <limit no>
In this case you <limit no> is 100 since you want to
return at most 100 rows.
hope that helps.
ludwig.
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
From | Date | Subject | |
---|---|---|---|
Next Message | h012 | 2002-08-09 04:38:20 | expressions operating on arrays |
Previous Message | Dawn Hollingsworth | 2002-08-08 20:10:38 | Table Sorting and Limit Question |