Re: queries on xmin - Mailing list pgsql-general

From Matt Amos
Subject Re: queries on xmin
Date
Msg-id 79d9e4e90906110536v3aae87deqedaf6e719b13ecc8@mail.gmail.com
Whole thread Raw
In response to Re: queries on xmin  (Brett Henderson <brett@bretth.com>)
Responses Re: queries on xmin
List pgsql-general
On Thu, Jun 11, 2009 at 1:13 PM, Brett Henderson<brett@bretth.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

pgsql-general by date:

Previous
From: Matt Amos
Date:
Subject: Re: queries on xmin
Next
From: Dimitri Fontaine
Date:
Subject: Re: Postgres Pg_connect PHP