Re: queries on xmin

From: Matt Amos <zerebubuth(at)gmail(dot)com>
To: Brett Henderson <brett(at)bretth(dot)com>
Cc: Marko Kreen <markokr(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: queries on xmin
Date: 2009-06-11 12:36:31
Message-ID: 79d9e4e90906110536v3aae87deqedaf6e719b13ecc8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jun 11, 2009 at 1:13 PM, Brett Henderson<brett(at)bretth(dot)com> wrote:
> Marko Kreen wrote:
> Sorry, I'm not sure what you're suggesting with txid_current().  We're
> currently using the |txid_current_snapshot|() method which returns us the
> maximum transaction id plus in-flight transactions.  We specifically exclude
> transactions that are in-flight from the query, then include them on
> subsequent queries when they have committed.

i think what marko is suggesting is a new column, e.g:

alter table X add column txid bigint default current_txid();

the current_txid() function returning an int8 which is the 32-bit txid
in the lower word and a 32-bit "epoch" counter in the higher word so
that it doesn't wrap-around.

>> See pgq.batch_event_sql() function in Skytools [2] for how to
>> query txids between snapshots efficiently and without being affected
>> by long transactions.
>
> I'll take a look.

it was looking at the skytools stuff which got me thinking about using
txids in the first place. someone on the osm-dev list had suggested
using PgQ, but we weren't keen on the schema changes that would have
been necessary.

cheers,

matt

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dimitri Fontaine 2009-06-11 12:36:39 Re: Postgres Pg_connect PHP
Previous Message Matt Amos 2009-06-11 12:28:07 Re: queries on xmin