Re: tracking commit timestamps

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Anssi Kääriäinen <anssi(dot)kaariainen(at)thl(dot)fi>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Subject: Re: tracking commit timestamps
Date: 2014-11-05 16:38:14
Message-ID: 20141105163814.GZ28295@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-www

On 2014-11-05 10:34:40 -0600, Jim Nasby wrote:
> On 11/5/14, 10:30 AM, Andres Freund wrote:
> >>Except that commit time is not guaranteed unique *even on a single
> >>>system*. That's my whole point. If we're going to bother with all the
> >>>commit time machinery it seems really silly to provide a way to
> >>>uniquely order every commit.

> >Well. I think that's the misunderstanding here. That's absolutely not
> >what committs is supposed to be used for. For the replication stream
> >you'd hopefully use logical decoding. That gives you the transaction
> >data exactly in commit order.
>
> So presumably you'd want to use logical decoding to insert into a
> table with a sequence on it, or similar?

I'm not following. I'd use logical decoding to replicate the data to
another system, thereby guaranteeing its done in commit order. Then,
when applying the data on the other side, I can detect/resolve some
forms of conflicts by looking at the timestamps of rows via committs.

> I agree, that sounds like a better way to handle this. I think it's
> worth mentioning in the docs for commit_ts, because people WILL
> mistakenly try and use it to determine commit ordering.

Ok, sounds sensible.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2014-11-05 16:46:07 Re: Repeatable read and serializable transactions see data committed after tx start
Previous Message Jim Nasby 2014-11-05 16:36:02 Re: B-Tree index builds, CLUSTER, and sortsupport

Browse pgsql-www by date

  From Date Subject
Next Message Kevin Grittner 2014-11-05 20:38:17 Re: tracking commit timestamps
Previous Message Jim Nasby 2014-11-05 16:34:40 Re: tracking commit timestamps