From: Alex@Icepick.com
To: pgsql-sql@postgresql.org
Subject: How to get last 10 rows in a table on a large database?
Date: Sat, 06 Nov 1999 10:37:17 GMT
Message-ID: <38270488.5980775@smtp.telekabel.nl> (raw)
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!
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: Alex@Icepick.com
Subject: Re: How to get last 10 rows in a table on a large database?
In-Reply-To: <38270488.5980775@smtp.telekabel.nl>
References: <38270488.5980775@smtp.telekabel.nl>
* 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