| Marko Kreen 2006-01-22, 8:24 pm |
| The first variant I sent was broken, as I decided
to clean up the module before public posting...
Sorry about that.
This is a fixed version that has also has interface
cleanup and smaller binary representation. I hope
the added regression tests will give it better mileage.
My app needs to know "active TXIDs in snap1 that were
commited in snap2" for faster searching. For that I had
a ugly C function that calculated those. Now I figured
out a way to do it in pure SQL, so I ripped it out.
That gives pretty clean interface:
get_current_txid() returns int8
Current transaction ID
get_current_snapshot
() returns txid_snapshot
Current snapshot
get_snapshot_xmin( [snap] ) returns int8
Smallest TXID in snapshot. TXID's smaller than this
are all visible in snapshot. Without argument uses
current snapshot.
get_snapshot_xmax( [snap] ) returns int8
Largest TXID in snapshot. TXID's starting from this one are
all invisible in snapshot. Without argument uses current snapshot.
get_snapshot_values(
[snap] ) setof int8
List of uncommitted TXID's in snapshot, that are invisible
in snapshot. Values are between xmin and xmax. Without
argument uses current snapshot.
txid_in_snapshot(id,
snap) returns bool
Is TXID visible in snapshot?
txid_not_in_snapshot
(id, snap) returns bool
Is TXID invisible in snapshot?
Note that this is indeed work-in-progress, so I'm just
looking if there is any outside interest on this topic.
--
marko
|