From: Ludwig Lim <lud_nowhere_man@yahoo.com>
To: Dawn Hollingsworth <dmh@airdefense.net>
Cc: PosgreSQL Mailing List <pgsql-sql@postgresql.org>
Subject: Re: Table Sorting and Limit Question
Date: Thu, 8 Aug 2002 18:42:23 -0700 (PDT)
Message-ID: <20020809014223.3100.qmail@web40009.mail.yahoo.com> (raw)
In-Reply-To: <1028837453.4754.1.camel@kaos>
--- Dawn Hollingsworth <dmh@airdefense.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: lud_nowhere_man@yahoo.com, dmh@airdefense.net
Subject: Re: Table Sorting and Limit Question
In-Reply-To: <20020809014223.3100.qmail@web40009.mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox