Subject Re: [firebird-support] Any SELECT or UPDATE transaction increases size of data base in 2 bits
Author Ann W. Harrison
gray_area_2 wrote:
>
> If I run transaction ...
> many times I got increase in size of the database in one page (4K)
> approximately for every 16K transactions. The increase is linear.
> Which means thet if I run 160K transactions it will be 10 pages.
>
> Have anyone observed this effect before? What causes it?

My guess is you're seeing the growth of TIPs (Transaction
Inventory Pages) and that the growth is stepwise rather than
strictly linear.

Firebird records the state of transactions on TIPs, using two
bits per transaction. Essentially the TIPs contain an array
of two-bit elements, indexed by transaction number. Each TIP
actually has some header information indicating that it's a
TIP and the page number of the next TIP. A 4Kb page holds a
bit more than 16K of entries - counting on my fingers I find
20 bytes of header, leaving 4076 bytes of entries or 16304
entries per page.

When a new TIP is allocated, all states are 0 - meaning that
the transactions are active or not yet started. As those
transactions finish their states are recorded as Limbo (1),
Dead (2), or Committed (3). When a transaction starts, the
system insures that the existence of TIP that will hold it.
Thus, creating transaction 16304 adds a page to the database.
Starting the next 16303 transactions won't affect the size
of the database - the next creates another new page.

When you run out of transaction numbers at 4G, you will
have used 263431 TIP pages.


Regards,


Ann