Unique transaction ID

Started by Robert Osowieckiover 20 years ago4 messagesgeneral
Jump to latest
#1Robert Osowiecki
robson@cavern.pl

Apart from now() function, is there some kind of sequence that advances
with each transaction started? If not: is it possible to implement that
using sequences?

Robson.

#2Jaime Casanova
jcasanov@systemguards.com.ec
In reply to: Robert Osowiecki (#1)
Re: Unique transaction ID

On 1/4/06, Robert Osowiecki <robson@cavern.pl> wrote:

Apart from now() function, is there some kind of sequence that advances
with each transaction started? If not: is it possible to implement that
using sequences?

Robson.

it exists a transaction id called XID, you can't get it via sql
though, you need to make a c function and invoke GetTopTransactionId()
(or GetCurrentTransactionId() in versions prior to 8.0)

--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

#3Robert Osowiecki
robson@cavern.pl
In reply to: Jaime Casanova (#2)
Re: Unique transaction ID

Jaime Casanova napisaďż˝(a):

it exists a transaction id called XID, you can't get it via sql

though, you need to make a c function and invoke GetTopTransactionId()
(or GetCurrentTransactionId() in versions prior to 8.0)

I've read a little about problems with overlapping XID and how they were
resolved. I don't understand everything but it seems that XID could be
decreased after vacuum, could it?

Robson.

#4Jaime Casanova
jcasanov@systemguards.com.ec
In reply to: Robert Osowiecki (#3)
Re: Unique transaction ID

On 1/4/06, Robert Osowiecki <robson@cavern.pl> wrote:

Jaime Casanova napisał(a):

it exists a transaction id called XID, you can't get it via sql

though, you need to make a c function and invoke GetTopTransactionId()
(or GetCurrentTransactionId() in versions prior to 8.0)

I've read a little about problems with overlapping XID and how they were
resolved. I don't understand everything but it seems that XID could be
decreased after vacuum, could it?

Robson.

NO!!!

if for overlapping you are refering to the wraparound problem you just
have to execute VACUUM at least every billion transactions or if you
are in 8.1.x let autovaccum keep you safe...

http://www.postgresql.org/docs/current/static/maintenance.html#VACUUM-FOR-WRAPAROUND

--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)