Table Sorting and Limit Question
Table Sorting and Limit Question
От:
Dawn Hollingsworth <dmh@airdefense.net>
Дата:
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? Dawn Hollingsworth Principal Engineer AirDefense, Inc.
Re: Table Sorting and Limit Question
От:
Ludwig Lim <lud_nowhere_man@yahoo.com>
Дата:
--- Dawn Hollingsworth 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
Re: Table Sorting and Limit Question
От:
Dawn Hollingsworth <dmh@airdefense.net>
Дата:
Since the id is a sequence type it should be unique. In this case it also happens to be my primary key into this table which will also make it unique. So the query below would only return 1 row. The part I'm missing is the offset number of the limit. Is there any way to figure out which offset into the query would contain the id I'm interested in. Dawn Hollingsworth Principal Engineer AirDefense, Inc. On Thu, 2002-08-08 at 21:42, Ludwig Lim wrote: > > --- Dawn Hollingsworth 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
update on a large table
От:
"Aaron Held" <aaron@metrony.com>
Дата:
I need to do an UPDATE on a large (100 million record) table. Is there any way to speed up the process (Like turning off the transaction log)? So far postgres has been handling the large database exceptionally well (large \copy imports and WHERE clauses w/ multiple params) but it is killing me on UPDATES. It takes about 4 hours to run an UPDATE (the WHERE clause is against an INDEX) but about 50 sec for a similar SELECT. Thank You, -Aaron Held