Using xmin to identify last modified rows

From: "Stéphane A(dot) Schildknecht" <stephane(dot)schildknecht(at)postgresqlfr(dot)org>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Using xmin to identify last modified rows
Date: 2009-02-25 12:00:40
Message-ID: 49A532E8.5090803@postgresqlfr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Trying to identify last modified (updated or inserted) rows in a table, I
thought I could use xmin.

I tried is to get some lines sorted by xmin.

When doing it on a slonified database, I had no problem getting these lines.

But, trying the same query on a non slonified DB, I got an error, as there is
no ordering operator for xid.

I think that in the slon case, the query uses the implicit cast xid->xxid, and
then the operator to sort xxid.

What would be the best way to get last modified rows?

What I tried :
db=# select id_table, date_table, code_table from tb_table order by xmin desc
limit 10;
ERROR: could not identify an ordering operator for type xid
ASTUCE : Use an explicit ordering operator or modify the query.

Thanks in advance.

Best regards,
- --
Stéphane Schildknecht
PostgreSQLFr - http://www.postgresql.fr
Dalibo - http://www.dalibo.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJpTLoA+REPKWGI0ERAiCaAKCOSFQp/RtWFaLScwXLpqXQJKGzLgCgsNUn
jXCUCSBBXVP7WEIn/M0Pklc=
=PN5v
-----END PGP SIGNATURE-----

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shahbaz A. Tyagi 2009-02-25 12:08:25 Restore DB
Previous Message Michael Akinde 2009-02-25 11:45:37 Re: Large object loading stalls