Subject Re: [firebird-support] Transaction Info
Author Helen Borrie
At 10:52 PM 15/11/2005 +0000, you wrote:
>A few questions regarding transactions:
>
>1. Is it possible to get the transaction number in a trigger ?

current_transaction (Fb 1.5 and higher).


>2. Are the transaction numbers assigned in an increasing sequence ?

Yes. Strictly - within the life of the currently created database
version. Gets reset to 0 on restore.


>3. gstat gives information about the oldest transaction and oldest
>active. What is the difference between the two ?

Oldest active, a.k.a. OAT is the oldest (lowest numbered) transaction that
is running at the time gstat reads the transaction inventory. "Active" =
not committed or rolled back.

Oldest = "Oldest interesting", a.k.a. OIT, is the lowest numbered
read-write transaction (which may or may not be active) that is still
associated with record versions that cannot be released. Typically you get
a big gap between the OIT and the OAT if you have read-write transactions
that last for hours, days or even weeks. The culprits are usually a SELECT
statement in a read-write transaction that is never committed; and/or DML
statements that get committed using Commit Retaining.

>Is it possible to obtain this information using any firebird API ?

No. Gstat is a file-level utility that reads the transaction inventory
directly from the database file, i.e. doesn't connect through the client
interface (a.k.a. API). The API is transaction contingent, i.e. anything a
client instance sees is through the context of its own connection to a
specific database.

./heLen