Re: Using xmin to identify last modified rows

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: Stéphane A(dot) Schildknecht <stephane(dot)schildknecht(at)postgresqlfr(dot)org>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using xmin to identify last modified rows
Date: 2009-02-25 13:21:12
Message-ID: 871vtmveif.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Stéphane A. Schildknecht" <stephane(dot)schildknecht(at)postgresqlfr(dot)org> writes:

> 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.

You could order by age(xmin) instead

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

I'm not sure using xmin is such a great idea really. It's handy for ad-hoc
queries but there are all kinds of cases where it might not give you the
results you expect.

You probably want to put a timestamp column on your tables and manage the date
you put in their according to a policy you control.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's 24x7 Postgres support!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Knut P. Lehre 2009-02-25 13:29:36 Several simultaneous libpq connections from the same application to different servers using different SSL certs
Previous Message Grzegorz Jaśkiewicz 2009-02-25 13:20:21 Re: funny view/temp table problem with query