How to get last 10 rows in a table on a large database? - Mailing list pgsql-sql

From Alex@Icepick.com (Alex)
Subject How to get last 10 rows in a table on a large database?
Date
Msg-id 38270488.5980775@smtp.telekabel.nl
Whole thread Raw
Responses Re: [SQL] How to get last 10 rows in a table on a large database?  (Stoyan Genov <genov@digsys.bg>)
Re: [SQL] How to get last 10 rows in a table on a large database?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Hi,

Does anyone have a good idea to get the last 10 rows from a table? I
tried 

SELECT * FROM table ORDER BY datetime DESC LIMIT 10

But my table has over 1 million rows, so this takes forever.. anyone
has a better idea on how to do this? 

Alex
--
Alex van Es, P.O. Box 698, 7300 AR Apeldoorn, The Netherlands.
8 Webcams, doorbell, fridge, barcodescanner.. all connected to the internet.
Check http://www.icepick.com for details.. 
NEW! A Hyperwired cat.. http://www.blackie.com!


pgsql-sql by date:

Previous
From: Heiko Wilms
Date:
Subject: pg_dump and "archive = none" ??
Next
From: Stoyan Genov
Date:
Subject: Re: [SQL] How to get last 10 rows in a table on a large database?