From: | "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | "Stéphane A(dot) Schildknecht" *EXTERN* <stephane(dot)schildknecht(at)postgresqlfr(dot)org>, "Postgres General" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Using xmin to identify last modified rows |
Date: | 2009-02-25 15:31:21 |
Message-ID: | D960CB61B694CF459DCFB4B0128514C2031AB58B@exadv11.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Stéphane A. Schildknecht wrote:
> 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.
What about:
test=> SELECT xmin, * FROM mausi ORDER BY xmin::text::bigint;
xmin | id | val
-------+----+----------------
14005 | 1 | test\test/test
14040 | 3 | mamma
(2 rows)
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Stark | 2009-02-25 15:36:15 | Re: Using xmin to identify last modified rows |
Previous Message | Ashish Karalkar | 2009-02-25 15:15:49 | Re: Restore DB |