From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stoyan Genov <genov@digsys.bg>
Cc: Alex@icepick.com
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] How to get last 10 rows in a table on a large database?
Date: Sat, 06 Nov 1999 13:16:58 -0500
Message-ID: <2549.941912218@sss.pgh.pa.us> (raw)
In-Reply-To: <199911061136.NAA00556@lorna.digsys.bg>
Stoyan Genov <genov@digsys.bg> writes:
> You are unable to say:
> begin transaction;
> declare tbl_cur cursor for .... .....
> move forward all in tbl_cur;
> fetch backward 10 in tbl_cur;
> ...........
> end transaction;
> because when you "move forward all" the result gets lost.
Huh? It seems to work fine for me.
However, the "move" is a tad slow since the silly thing actually scans
over all the tuples in index order :-(. This might not be a useful
solution for Alex's problem after all, because of the time taken by
the "move".
regards, tom lane
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: tgl@sss.pgh.pa.us, genov@digsys.bg, Alex@icepick.com
Subject: Re: [SQL] How to get last 10 rows in a table on a large database?
In-Reply-To: <2549.941912218@sss.pgh.pa.us>
References: <199911061136.NAA00556@lorna.digsys.bg> <2549.941912218@sss.pgh.pa.us>
* 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