SlideShare a Scribd company logo
1 
1 Firebird Conference 2014, Prague © IBSurgeon 
How Firebird transactions work 
Dmitry Kuzmenko 
www.IBSurgeon.com
2 
2 Firebird Conference 2014, Prague © IBSurgeon 
Thank you!
3 
3 Firebird Conference 2014, Prague © IBSurgeon 
• Tools and consulting 
• Platinum Sponsor of Firebird 
Foundation 
• Founded in 2002: 12 years of 
Firebird and InterBase recoveries 
and consulting 
• Based in Moscow, Russia
4 
4 Firebird Conference 2014, Prague © IBSurgeon 
Agenda 
What is transaction? Why we need it? 
How we will present about transactions 
Records and versions 
Transactions and record versions 
Transaction Inventory 
Record visibility in transactions 
Transaction Markers and their evaluation 
Some conclusions
5 
5 Firebird Conference 2014, Prague © IBSurgeon 
What is transaction? 
• Transaction as a general concept of any dynamic system 
• “Classic” example 
• begin 
• -- move money from account1 to account2 
• Decrease account1 
• Increase account2 
• end – commit/rollback 
• Transaction Managers
6 
6 Firebird Conference 2014, Prague © IBSurgeon 
Database transaction definition 
• a unit of work performed against a database, and treated 
in a coherent and reliable way independent of other 
transactions. 
• A database transaction, by definition, must be 
Atomic, Consistent, Isolated and Durable
7 
7 Firebird Conference 2014, Prague © IBSurgeon 
In ideal world 
Insert into T1(i1) 
values (100); 
SELECT i1 
FROM T1 
Insert into T1(i1) 
values (200); 
only serial operations
8 
8 Firebird Conference 2014, Prague © IBSurgeon
9 
9 Firebird Conference 2014, Prague © IBSurgeon
10 
10 Firebird Conference 2014, Prague © IBSurgeon 
In real world 
Tx11 
Tx14 
INSERT T1 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 
commit 
UPDATE T1 
nowait 
commit 
Tx20 
UPDATE T1 
rollback 
UPDATE T1
11 
11 Firebird Conference 2014, Prague © IBSurgeon 
The ultimate purpose of 
transaction: 
• Concurrent execution of operations should lead to the 
exactly the same result as sequental execution of 
operations. 
In simple words: each transaction should run as the only 
transaction. 
For each [snapshot] transaction Firebird engine should 
maintain a stable view of the database.
12 
12 Firebird Conference 2014, Prague © IBSurgeon
13 
13 Firebird Conference 2014, Prague © IBSurgeon 
How Firebird does implement stable 
view for each transactions?
14 
14 Firebird Conference 2014, Prague © IBSurgeon 
How we will present about transactions 
Start End 
Tx 11 
Transaction’s 
number 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
15 
15 Firebird Conference 2014, Prague © IBSurgeon 
How we will present about transactions 
Tx 11 
commit 
Tx 12 
rollback 
Transaction’s 
result 
Transaction’s 
result 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
16 
16 Firebird Conference 2014, Prague © IBSurgeon 
How we will present about transactions 
Tx 11 
commit 
snapshot 
Transaction’s 
parameters 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
17 
17 Firebird Conference 2014, Prague © IBSurgeon 
How we will present about transactions 
Tx 11 
commit 
Insert into T1(i1) 
values (100); 
snapshot 
Operation in the frames of 
transaction 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
18 
18 Firebird Conference 2014, Prague © IBSurgeon 
How we will present about transactions 
Result of operation 
Tx 11 
commit 
Insert into T1(i1) 
values (100); 
i1 
100 
SELECT i1 
FROM T1 
snapshot 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
19 
19 Firebird Conference 2014, Prague © IBSurgeon 
Now let's start... 
Basics your [probably] know: 
- Everything in the database is done within transaction 
- Each transaction get it’s own incremented number 
1, 2, 3, … etc 
- Firebird is a multi-version engine (each record in Firebird 
can have versions)
20 
20 Firebird Conference 2014, Prague © IBSurgeon 
Record versions is a key thing for 
understanding transactions' work in Firebird.
21 
21 Firebird Conference 2014, Prague © IBSurgeon 
How record versions appear 
Tx10 commit 
Insert into 
T1(i1) values 
(100); 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
22 
22 Firebird Conference 2014, Prague © IBSurgeon 
How record versions appear 
Tx10 commit 
Insert into 
T1(i1) values 
(100); 
Tx50 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 
commit 
SELECT i1 
FROM T1 
i1 
100
23 
23 Firebird Conference 2014, Prague © IBSurgeon 
How record versions appear 
Tx10 commit 
Insert into 
T1(i1) values 
(100); 
Tx50 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 
commit 
SELECT i1 
FROM T1 
i1 
100 
Tx60 
commit 
UPDATE T1 
SET i1=200 
new version!
24 
24 Firebird Conference 2014, Prague © IBSurgeon 
How record versions appear 
Tx10 commit 
Insert into 
T1(i1) values 
(100); 
Tx50 
i1 
200 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 
commit 
SELECT i1 
FROM T1 
i1 
100 
SELECT i1 
FROM T1 
Tx60 
commit 
UPDATE T1 
SET i1=200 
SELECT i1 
FROM T1 
i1 
100
25 
25 Firebird Conference 2014, Prague © IBSurgeon 
How it works?
26 
26 Firebird Conference 2014, Prague © IBSurgeon 
Each record version has transaction # 
N on page Transaction number Datafield1, datafield2 
1 50 100
27 
27 Firebird Conference 2014, Prague © IBSurgeon 
TR50 
read 
N Tx Data 
1 10 100 
...
28 
28 Firebird Conference 2014, Prague © IBSurgeon 
TR50 N Tx Data 
write TR60 
1 10 100 
... 
read
29 
29 Firebird Conference 2014, Prague © IBSurgeon 
TR50 N Tx Data 
TR60 
1 10 100 
60 200 
... 
read 
write
30 
30 Firebird Conference 2014, Prague © IBSurgeon 
TR50 TR60 
read 
N Tx Data 
1 10 100 
60 200 
... 
read 
write
31 
31 Firebird Conference 2014, Prague © IBSurgeon 
Some intermediate conclusions 
1. No “locks” are placed on the record 
2. There can be a lot of committed versions for one record 
3. Versions may be needed or not. If not, they can be 
considered as “garbage”. 
4. Only one non-committed version can exist for the record 
(2 active transactions can’t update the same record)
32 
32 Firebird Conference 2014, Prague © IBSurgeon 
How server knows about transactions states? 
Is transaction Active or not? 
•TIP – Transaction Inventory Pages 
• Linear list of transaction states, from 1 to last 
transaction number 
• Stored in the database 
• Limitation — 2 billions of transactions
33 
33 Firebird Conference 2014, Prague © IBSurgeon 
Transaction states 
• Each transaction is represented in 
Transactions Inventory by it’s state 
• 00 – Active 
• 01 – Committed 
• 10 – Rolled back 
• 11 – Limbo (distributed 2-phase 
transactions) 
TIP contents 
Tx № Tx state 
… 
10 committed 
11 committed 
12 committed 
13 rolled back 
14 committed 
15 committed 
16 committed 
17 rolled back 
18 active 
19 committed 
20 active
34 
34 Firebird Conference 2014, Prague © IBSurgeon 
Tx10 commit 
Insert into 
T1(i1) values 
(100); 
Tx50 
i1 
200 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 
commit 
SELECT i1 
FROM T1 
i1 
100 
SELECT i1 
FROM T1 
Tx60 
commit 
UPDATE T1 
SET i1=200 
SELECT i1 
FROM T1 
i1 
100 
TIP 
Tx State 
10 Commited 
Tx State 
10 Commited 
50 Active 
60 Active 
Tx State 
10 Commited 
50 Commited 
60 Commited
35 
35 Firebird Conference 2014, Prague © IBSurgeon 
Transaction isolation levels
36 
36 Firebird Conference 2014, Prague © IBSurgeon 
IIssoollaattiioonn lleevveellss iinn FFiirreebbiirrdd 
Isolation levels in Firebird 
READ COMMITED 
SNAPSHOT 
SNAPSHOT WITH TABLE STABILITY
37 
37 Firebird Conference 2014, Prague © IBSurgeon 
Snapshot 
Tx 51 rollback 
Insert into T1(i1) 
values (200); 
Tx 52 commit 
Insert into T1(i1) 
values (100); 
Tx 10 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 
commit 
SELECT FROM T1 SELECT FROM T1 
snapshot 
i1
38 
38 Firebird Conference 2014, Prague © IBSurgeon 
Read Commited 
Tx 15 commit 
Insert into T1(i1) 
values (100); 
Tx 10 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 
commit 
SELECT i1 
FROM T1 
SELECT i1 
FROM T1 
read commited 
i1 
100 i1
39 
39 Firebird Conference 2014, Prague © IBSurgeon 
Read Commited and Snapshot 
Read Committed transactions “see” global TIP. 
That’s why they can read committed changes of other transactions 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 
Snapshot copies TIP on it’s start. It does not see any changes made by 
other committed transactions after snapshot start 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
40 
40 Firebird Conference 2014, Prague © IBSurgeon 
TIP for Read Commited 
Tx 15 commit 
Insert into T1(i1) 
values (100); 
Tx 10 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 
commit 
SELECT i1 
FROM T1 
SELECT i1 
FROM T1 
read commited 
i1 
100 i1 
Tx State 
10 Active 
Tx State 
10 Active 
15 Active 
Tx State 
10 Active 
15 Commited
41 
41 Firebird Conference 2014, Prague © IBSurgeon 
Tx 51 rollback 
Insert into T1(i1) 
values (200); 
Tx 52 commit 
Insert into T1(i1) 
values (100); 
Tx 10 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 
commit 
SELECT FROM T1 SELECT FROM T1 
snapshot 
i1 
Tx State 
10 Active 
Tx State 
10 Active 
51 Active 
52 Active 
Tx State 
10 Active 
51 Rollback 
52 Commited 
Tx State 
10 Active 
TIP for snapshot
42 
42 Firebird Conference 2014, Prague © IBSurgeon 
Each transaction can see: 
• Own created records and versions 
• Insert, Update, Delete 
• If it is Read Committed, it can see every changes that 
was made by committed transactions, because it looks 
into global TIP 
• If it is Snapshot, it can see own changes and record 
versions commited to the moment of its start, because it 
looks into it’s own copy of TIP
43 
43 Firebird Conference 2014, Prague © IBSurgeon 
Record versions visibility
44 
44 Firebird Conference 2014, Prague © IBSurgeon 
How we will present about records 
Each record can have versions, created by 
different transactions 
Record 10 Tx 10 100 Tx 20 200 Tx 30 555
45 
45 Firebird Conference 2014, Prague © IBSurgeon 
How we will present about records 
Record 10 Tx 10 100 Tx 20 200 Tx 30 555 
Compact representation 
R10 Tx 10 Tx 20 Tx 30
46 
46 Firebird Conference 2014, Prague © IBSurgeon 
3 rules of record visibilty 
1) For each snapshot transaction engine maintains 
stable view of database 
2) Transaction can not see record versions created 
by another active transaction 
3) Transaction should walk backversions chain 
looking for commited backversion
47 
47 Firebird Conference 2014, Prague © IBSurgeon 
Ex: record versions visibility for Tx20 
Snapshot isolation, copy of TIP for Tx20
48 
48 Firebird Conference 2014, Prague © IBSurgeon 
• In order to figure out which record version is 
visible, every transaction must read TIP 
• TIP can contain up to 2 Billion transactions 
• So each transaction should read up to 2 billions 
of transactions! - Damn, that's why Firebird is 
slow! (it's a joke)
49 
49 Firebird Conference 2014, Prague © IBSurgeon 
TIP (example) 
We need a way to separate old, not interesting 
transactions from currently active part of TIP 
● For this purpose engine maintains Oldest 
Interesting Transaction marker, or OIT
50 
50 Firebird Conference 2014, Prague © IBSurgeon 
TIP (example)
51 
51 Firebird Conference 2014, Prague © IBSurgeon
52 
52 Firebird Conference 2014, Prague © IBSurgeon 
Transaction markers 
firebird>gstat -h A.FDB 
Database header page information: 
Flags 0 
Generation 6 
System Change Number 0 
Page size 4096 
ODS version 12.0 
Oldest transaction 1 
Oldest active 2 
Oldest snapshot 2 
Next transaction 3 
Sequence number 0 
Next attachment ID 3
53 
53 Firebird Conference 2014, Prague © IBSurgeon 
4 markers 
• Transaction markers are key characterstics of 
TIP and transaction mechanism 
– Let's see what they mean and how they evaluated: 
• NEXT — next transaction 
• OAT — Oldest Active 
• OST — Oldest Snapshot 
• OIT — Oldest Interesting
54 
54 Firebird Conference 2014, Prague © IBSurgeon 
NEXT 
• NEXT is the simplest — it's the most recent 
transaction 
• NEXT number is written on header page
55 
55 Firebird Conference 2014, Prague © IBSurgeon 
OAT - Oldest Active Transaction 
OAT is the first transaction in TIP which state is 
“active” 
Evaluation: 
● Scan TIP starting from current OAT value looking 
for “active” transaction 
● Save found value in transaction's lock data 
● Save found value as new OAT marker 
OAT is really an oldest active transaction
56 
56 Firebird Conference 2014, Prague © IBSurgeon 
OAT evaluation example
57 
57 Firebird Conference 2014, Prague © IBSurgeon 
Problems indicated by OAT 
● Where to look? 
● NEXT — OAT > (number of connections * number of 
transaction) 
● What it means? 
● Long running transaction which makes Firebird to 
think that record versions are still needed
58 
58 Firebird Conference 2014, Prague © IBSurgeon
59 
59 Firebird Conference 2014, Prague © IBSurgeon
60 
60 Firebird Conference 2014, Prague © IBSurgeon
61 
61 Firebird Conference 2014, Prague © IBSurgeon 
OST and Read Commited transactions
62 
62 Firebird Conference 2014, Prague © IBSurgeon
63 
63 Firebird Conference 2014, Prague © IBSurgeon 
UPDATE T1 
UPDATE T1 
UPDATE T1 
UPDATE T1 
UPDATE T1 
N Tx Data 
1 4 ccc 
2 1 aaa 
3 2 bbb 
4 3 bbbb 
5 
6 
7 
... 
Select * from 
write rdb$database 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 
The longer transaction lasts, the higher chance to create potentially 
useless (potential garbage) versions
64 
64 Firebird Conference 2014, Prague © IBSurgeon 
Problems indicated by OST 
Where to look 
(OST-OIT) > sweep interval 
What it means 
– Autosweep does not work (if sweep interval >0) 
– Some records need garbage collection
65 
65 Firebird Conference 2014, Prague © IBSurgeon 
Problems caused by long running 
transactions 
• Direct 
• Loss of performance due to more record versions: i.e., queries 
become slower 
• More indexed reads 
• More data page reads 
• 1.5mln versions ~30mb per record 
• Indirect 
• After transaction’s end its versions become garbage, and garbage 
collection mechanism tries to gather it 
• Due to long transaction OST stuck, so autosweep (if it is not 
disabled) tries to start at unpredictable moment (and ends without 
success) 
• GC and sweep can consume a lot of resources 
• Unpredictable moment can occur at high load time
66 
66 Firebird Conference 2014, Prague © IBSurgeon 
Oldest Interesting Transaction
67 
67 Firebird Conference 2014, Prague © IBSurgeon 
TIP size 
• TIP to be copied is NEXT - OIT 
• Size of active part of the TIP in bytes is (Next – OIT) / 4
68 
68 Firebird Conference 2014, Prague © IBSurgeon
69 
69 Firebird Conference 2014, Prague © IBSurgeon 
Problems indicated by OIT 
Where to look 
OIT- OST 
Problem 
Big size of TIP 
— Global, and, 
specifically copies 
of TIP for snapshots
70 
70 Firebird Conference 2014, Prague © IBSurgeon 
Ideal transactions flow 
TxNN 
TxNN 
TxNN 
TxNN 
TxNN 
TxNN 
TxNN 
TxNN Short transactions does 
not stuck OIT or OAT or 
OST, and avoid problems 
related with it. 
Oldest transaction X-1 
Oldest active X 
Oldest snapshot X 
Next transaction X+1 
t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
71 
71 Firebird Conference 2014, Prague © IBSurgeon 
Summary 
• Make write (for INSERT/UPDATE/DELETE) 
transactions as short as possible 
• Use Read Commited Read-Only transactions for 
SELECTs
72 
72 Firebird Conference 2014, Prague © IBSurgeon 
Thank you! 
• Questions? support@ib-aid.com

More Related Content

Viewers also liked

Firebird
FirebirdFirebird
Firebird
Chinsan Huang
 
New SQL Features in Firebird 3, by Vlad Khorsun
New SQL Features in Firebird 3, by Vlad KhorsunNew SQL Features in Firebird 3, by Vlad Khorsun
New SQL Features in Firebird 3, by Vlad Khorsun
Mind The Firebird
 
Tips for using Firebird system tables
Tips for using Firebird system tablesTips for using Firebird system tables
Tips for using Firebird system tables
Mind The Firebird
 
SuperServer in Firebird 3
SuperServer in Firebird 3SuperServer in Firebird 3
SuperServer in Firebird 3
Mind The Firebird
 
Life with big Firebird databases
Life with big Firebird databasesLife with big Firebird databases
Life with big Firebird databases
Alexey Kovyazin
 
Resolving Firebird performance problems
Resolving Firebird performance problemsResolving Firebird performance problems
Resolving Firebird performance problems
Alexey Kovyazin
 

Viewers also liked (6)

Firebird
FirebirdFirebird
Firebird
 
New SQL Features in Firebird 3, by Vlad Khorsun
New SQL Features in Firebird 3, by Vlad KhorsunNew SQL Features in Firebird 3, by Vlad Khorsun
New SQL Features in Firebird 3, by Vlad Khorsun
 
Tips for using Firebird system tables
Tips for using Firebird system tablesTips for using Firebird system tables
Tips for using Firebird system tables
 
SuperServer in Firebird 3
SuperServer in Firebird 3SuperServer in Firebird 3
SuperServer in Firebird 3
 
Life with big Firebird databases
Life with big Firebird databasesLife with big Firebird databases
Life with big Firebird databases
 
Resolving Firebird performance problems
Resolving Firebird performance problemsResolving Firebird performance problems
Resolving Firebird performance problems
 

Similar to How Firebird transactions work

PLC Training Intro
PLC Training IntroPLC Training Intro
PLC Training Intro
Business Industrial Network
 
Efficient Scheduler for Electronic Funds Tranfer (EFT) Scenarios
Efficient Scheduler for Electronic Funds Tranfer (EFT) ScenariosEfficient Scheduler for Electronic Funds Tranfer (EFT) Scenarios
Efficient Scheduler for Electronic Funds Tranfer (EFT) Scenarios
rrrighi
 
Dee2034 chapter 6 register
Dee2034 chapter 6 registerDee2034 chapter 6 register
Dee2034 chapter 6 register
SITI SABARIAH SALIHIN
 
25.3.10 packet tracer explore a net flow implementation
25.3.10 packet tracer   explore a net flow implementation25.3.10 packet tracer   explore a net flow implementation
25.3.10 packet tracer explore a net flow implementation
Freddy Buenaño
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
vipinkmenon1
 
Local or Global Sourcing and Firms' Performance: Empirical Evidence from the ...
Local or Global Sourcing and Firms' Performance: Empirical Evidence from the ...Local or Global Sourcing and Firms' Performance: Empirical Evidence from the ...
Local or Global Sourcing and Firms' Performance: Empirical Evidence from the ...
Structuralpolicyanalysis
 
CPU
CPUCPU
An cm-303 8-bit-siso_sipo_piso_pipo_shift_registers
An cm-303 8-bit-siso_sipo_piso_pipo_shift_registersAn cm-303 8-bit-siso_sipo_piso_pipo_shift_registers
Eee3420 lecture04 rev2011
Eee3420 lecture04 rev2011Eee3420 lecture04 rev2011
Eee3420 lecture04 rev2011
benson215
 
Loader
LoaderLoader
Loader
nikhilshrama
 
Consistent Updates in Software-De!ned Networks
Consistent Updates in Software-De!ned NetworksConsistent Updates in Software-De!ned Networks
Consistent Updates in Software-De!ned Networks
Open Networking Summits
 
Hardware Description Beyond Register-Transfer Level (RTL) Languages
Hardware Description Beyond Register-Transfer Level (RTL) LanguagesHardware Description Beyond Register-Transfer Level (RTL) Languages
Hardware Description Beyond Register-Transfer Level (RTL) Languages
LEGATO project
 
Instruction set
Instruction setInstruction set
Instruction set
Lívia Sousa
 
Eee3420 lecture04 rev2011
Eee3420 lecture04 rev2011Eee3420 lecture04 rev2011
Eee3420 lecture04 rev2011
benson215
 
OCBC_MX-3.1Pre-Post-Trade-Walk-Through.ppt
OCBC_MX-3.1Pre-Post-Trade-Walk-Through.pptOCBC_MX-3.1Pre-Post-Trade-Walk-Through.ppt
OCBC_MX-3.1Pre-Post-Trade-Walk-Through.ppt
Faisal Sal
 
Using Apache Fluo to Create a Derived Graph
Using Apache Fluo to Create a Derived GraphUsing Apache Fluo to Create a Derived Graph
Using Apache Fluo to Create a Derived Graph
Accumulo Summit
 
Describe the register
Describe the registerDescribe the register
Describe the register
Brenda Debra
 
TaxCycle Software and Tax Update Seminar Tour October 2013 for Canadian Tax P...
TaxCycle Software and Tax Update Seminar Tour October 2013 for Canadian Tax P...TaxCycle Software and Tax Update Seminar Tour October 2013 for Canadian Tax P...
TaxCycle Software and Tax Update Seminar Tour October 2013 for Canadian Tax P...
Trilogy Software
 
Sap edi idoc
Sap edi idocSap edi idoc
Sap edi idoc
Lokesh Modem
 
Running Flink in Production: The good, The bad and The in Between - Lakshmi ...
Running Flink in Production:  The good, The bad and The in Between - Lakshmi ...Running Flink in Production:  The good, The bad and The in Between - Lakshmi ...
Running Flink in Production: The good, The bad and The in Between - Lakshmi ...
Flink Forward
 

Similar to How Firebird transactions work (20)

PLC Training Intro
PLC Training IntroPLC Training Intro
PLC Training Intro
 
Efficient Scheduler for Electronic Funds Tranfer (EFT) Scenarios
Efficient Scheduler for Electronic Funds Tranfer (EFT) ScenariosEfficient Scheduler for Electronic Funds Tranfer (EFT) Scenarios
Efficient Scheduler for Electronic Funds Tranfer (EFT) Scenarios
 
Dee2034 chapter 6 register
Dee2034 chapter 6 registerDee2034 chapter 6 register
Dee2034 chapter 6 register
 
25.3.10 packet tracer explore a net flow implementation
25.3.10 packet tracer   explore a net flow implementation25.3.10 packet tracer   explore a net flow implementation
25.3.10 packet tracer explore a net flow implementation
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Local or Global Sourcing and Firms' Performance: Empirical Evidence from the ...
Local or Global Sourcing and Firms' Performance: Empirical Evidence from the ...Local or Global Sourcing and Firms' Performance: Empirical Evidence from the ...
Local or Global Sourcing and Firms' Performance: Empirical Evidence from the ...
 
CPU
CPUCPU
CPU
 
An cm-303 8-bit-siso_sipo_piso_pipo_shift_registers
An cm-303 8-bit-siso_sipo_piso_pipo_shift_registersAn cm-303 8-bit-siso_sipo_piso_pipo_shift_registers
An cm-303 8-bit-siso_sipo_piso_pipo_shift_registers
 
Eee3420 lecture04 rev2011
Eee3420 lecture04 rev2011Eee3420 lecture04 rev2011
Eee3420 lecture04 rev2011
 
Loader
LoaderLoader
Loader
 
Consistent Updates in Software-De!ned Networks
Consistent Updates in Software-De!ned NetworksConsistent Updates in Software-De!ned Networks
Consistent Updates in Software-De!ned Networks
 
Hardware Description Beyond Register-Transfer Level (RTL) Languages
Hardware Description Beyond Register-Transfer Level (RTL) LanguagesHardware Description Beyond Register-Transfer Level (RTL) Languages
Hardware Description Beyond Register-Transfer Level (RTL) Languages
 
Instruction set
Instruction setInstruction set
Instruction set
 
Eee3420 lecture04 rev2011
Eee3420 lecture04 rev2011Eee3420 lecture04 rev2011
Eee3420 lecture04 rev2011
 
OCBC_MX-3.1Pre-Post-Trade-Walk-Through.ppt
OCBC_MX-3.1Pre-Post-Trade-Walk-Through.pptOCBC_MX-3.1Pre-Post-Trade-Walk-Through.ppt
OCBC_MX-3.1Pre-Post-Trade-Walk-Through.ppt
 
Using Apache Fluo to Create a Derived Graph
Using Apache Fluo to Create a Derived GraphUsing Apache Fluo to Create a Derived Graph
Using Apache Fluo to Create a Derived Graph
 
Describe the register
Describe the registerDescribe the register
Describe the register
 
TaxCycle Software and Tax Update Seminar Tour October 2013 for Canadian Tax P...
TaxCycle Software and Tax Update Seminar Tour October 2013 for Canadian Tax P...TaxCycle Software and Tax Update Seminar Tour October 2013 for Canadian Tax P...
TaxCycle Software and Tax Update Seminar Tour October 2013 for Canadian Tax P...
 
Sap edi idoc
Sap edi idocSap edi idoc
Sap edi idoc
 
Running Flink in Production: The good, The bad and The in Between - Lakshmi ...
Running Flink in Production:  The good, The bad and The in Between - Lakshmi ...Running Flink in Production:  The good, The bad and The in Between - Lakshmi ...
Running Flink in Production: The good, The bad and The in Between - Lakshmi ...
 

More from Mind The Firebird

Using Azure cloud and Firebird to develop applications easily
Using Azure cloud and Firebird to develop applications easilyUsing Azure cloud and Firebird to develop applications easily
Using Azure cloud and Firebird to develop applications easily
Mind The Firebird
 
A year in the life of Firebird .Net provider
A year in the life of Firebird .Net providerA year in the life of Firebird .Net provider
A year in the life of Firebird .Net provider
Mind The Firebird
 
Copycat presentation
Copycat presentationCopycat presentation
Copycat presentation
Mind The Firebird
 
Using ТРСС to study Firebird performance
Using ТРСС to study Firebird performanceUsing ТРСС to study Firebird performance
Using ТРСС to study Firebird performance
Mind The Firebird
 
Overview of RedDatabase 2.5
Overview of RedDatabase 2.5Overview of RedDatabase 2.5
Overview of RedDatabase 2.5
Mind The Firebird
 
Firebird Performance counters in details
Firebird Performance counters in detailsFirebird Performance counters in details
Firebird Performance counters in details
Mind The Firebird
 
Understanding Numbers in Firebird SQL
Understanding Numbers in Firebird SQLUnderstanding Numbers in Firebird SQL
Understanding Numbers in Firebird SQL
Mind The Firebird
 
Threading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyondThreading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyond
Mind The Firebird
 
Orphans, Corruption, Careful Write, and Logging
Orphans, Corruption, Careful Write, and LoggingOrphans, Corruption, Careful Write, and Logging
Orphans, Corruption, Careful Write, and Logging
Mind The Firebird
 
Firebird release strategy and roadmap for 2015/2016
Firebird release strategy and roadmap for 2015/2016Firebird release strategy and roadmap for 2015/2016
Firebird release strategy and roadmap for 2015/2016
Mind The Firebird
 
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Mind The Firebird
 
Working with Large Firebird databases
Working with Large Firebird databasesWorking with Large Firebird databases
Working with Large Firebird databases
Mind The Firebird
 
Stored procedures in Firebird
Stored procedures in FirebirdStored procedures in Firebird
Stored procedures in Firebird
Mind The Firebird
 
Firebird on Linux
Firebird on LinuxFirebird on Linux
Firebird on Linux
Mind The Firebird
 
Superchaging big production systems on Firebird: transactions, garbage, maint...
Superchaging big production systems on Firebird: transactions, garbage, maint...Superchaging big production systems on Firebird: transactions, garbage, maint...
Superchaging big production systems on Firebird: transactions, garbage, maint...
Mind The Firebird
 
Firebird meets NoSQL
Firebird meets NoSQLFirebird meets NoSQL
Firebird meets NoSQL
Mind The Firebird
 
Continuous Database Monitoring with the Trace API
Continuous Database Monitoring with the Trace APIContinuous Database Monitoring with the Trace API
Continuous Database Monitoring with the Trace API
Mind The Firebird
 
Firebird Conference 2011 - Introduction
Firebird Conference 2011 - IntroductionFirebird Conference 2011 - Introduction
Firebird Conference 2011 - Introduction
Mind The Firebird
 
Firebird database recovery and protection for enterprises and ISV
Firebird database recovery and protection for enterprises and ISVFirebird database recovery and protection for enterprises and ISV
Firebird database recovery and protection for enterprises and ISV
Mind The Firebird
 
Migration from Firebird 1.5 to Firebird 2.5
Migration from Firebird 1.5 to Firebird 2.5Migration from Firebird 1.5 to Firebird 2.5
Migration from Firebird 1.5 to Firebird 2.5
Mind The Firebird
 

More from Mind The Firebird (20)

Using Azure cloud and Firebird to develop applications easily
Using Azure cloud and Firebird to develop applications easilyUsing Azure cloud and Firebird to develop applications easily
Using Azure cloud and Firebird to develop applications easily
 
A year in the life of Firebird .Net provider
A year in the life of Firebird .Net providerA year in the life of Firebird .Net provider
A year in the life of Firebird .Net provider
 
Copycat presentation
Copycat presentationCopycat presentation
Copycat presentation
 
Using ТРСС to study Firebird performance
Using ТРСС to study Firebird performanceUsing ТРСС to study Firebird performance
Using ТРСС to study Firebird performance
 
Overview of RedDatabase 2.5
Overview of RedDatabase 2.5Overview of RedDatabase 2.5
Overview of RedDatabase 2.5
 
Firebird Performance counters in details
Firebird Performance counters in detailsFirebird Performance counters in details
Firebird Performance counters in details
 
Understanding Numbers in Firebird SQL
Understanding Numbers in Firebird SQLUnderstanding Numbers in Firebird SQL
Understanding Numbers in Firebird SQL
 
Threading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyondThreading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyond
 
Orphans, Corruption, Careful Write, and Logging
Orphans, Corruption, Careful Write, and LoggingOrphans, Corruption, Careful Write, and Logging
Orphans, Corruption, Careful Write, and Logging
 
Firebird release strategy and roadmap for 2015/2016
Firebird release strategy and roadmap for 2015/2016Firebird release strategy and roadmap for 2015/2016
Firebird release strategy and roadmap for 2015/2016
 
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
 
Working with Large Firebird databases
Working with Large Firebird databasesWorking with Large Firebird databases
Working with Large Firebird databases
 
Stored procedures in Firebird
Stored procedures in FirebirdStored procedures in Firebird
Stored procedures in Firebird
 
Firebird on Linux
Firebird on LinuxFirebird on Linux
Firebird on Linux
 
Superchaging big production systems on Firebird: transactions, garbage, maint...
Superchaging big production systems on Firebird: transactions, garbage, maint...Superchaging big production systems on Firebird: transactions, garbage, maint...
Superchaging big production systems on Firebird: transactions, garbage, maint...
 
Firebird meets NoSQL
Firebird meets NoSQLFirebird meets NoSQL
Firebird meets NoSQL
 
Continuous Database Monitoring with the Trace API
Continuous Database Monitoring with the Trace APIContinuous Database Monitoring with the Trace API
Continuous Database Monitoring with the Trace API
 
Firebird Conference 2011 - Introduction
Firebird Conference 2011 - IntroductionFirebird Conference 2011 - Introduction
Firebird Conference 2011 - Introduction
 
Firebird database recovery and protection for enterprises and ISV
Firebird database recovery and protection for enterprises and ISVFirebird database recovery and protection for enterprises and ISV
Firebird database recovery and protection for enterprises and ISV
 
Migration from Firebird 1.5 to Firebird 2.5
Migration from Firebird 1.5 to Firebird 2.5Migration from Firebird 1.5 to Firebird 2.5
Migration from Firebird 1.5 to Firebird 2.5
 

Recently uploaded

Optimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptxOptimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptx
WebConnect Pvt Ltd
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
Jhone kinadey
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Peter Caitens
 
Hyperledger Besu 빨리 따라하기 (Private Networks)
Hyperledger Besu 빨리 따라하기 (Private Networks)Hyperledger Besu 빨리 따라하기 (Private Networks)
Hyperledger Besu 빨리 따라하기 (Private Networks)
wonyong hwang
 
Beginner's Guide to Observability@Devoxx PL 2024
Beginner's  Guide to Observability@Devoxx PL 2024Beginner's  Guide to Observability@Devoxx PL 2024
Beginner's Guide to Observability@Devoxx PL 2024
michniczscribd
 
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical OperationsEnsuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
OnePlan Solutions
 
Streamlining End-to-End Testing Automation
Streamlining End-to-End Testing AutomationStreamlining End-to-End Testing Automation
Streamlining End-to-End Testing Automation
Anand Bagmar
 
How GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdfHow GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdf
Zycus
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
Hands-on with Apache Druid: Installation & Data Ingestion Steps
Hands-on with Apache Druid: Installation & Data Ingestion StepsHands-on with Apache Druid: Installation & Data Ingestion Steps
Hands-on with Apache Druid: Installation & Data Ingestion Steps
servicesNitor
 
The Role of DevOps in Digital Transformation.pdf
The Role of DevOps in Digital Transformation.pdfThe Role of DevOps in Digital Transformation.pdf
The Role of DevOps in Digital Transformation.pdf
mohitd6
 
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery FleetStork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Vince Scalabrino
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
ervikas4
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
campbellclarkson
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Paul Brebner
 
What is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdfWhat is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdf
kalichargn70th171
 
Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...
Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...
Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...
Ortus Solutions, Corp
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio, Inc.
 

Recently uploaded (20)

Optimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptxOptimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptx
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
 
Hyperledger Besu 빨리 따라하기 (Private Networks)
Hyperledger Besu 빨리 따라하기 (Private Networks)Hyperledger Besu 빨리 따라하기 (Private Networks)
Hyperledger Besu 빨리 따라하기 (Private Networks)
 
Beginner's Guide to Observability@Devoxx PL 2024
Beginner's  Guide to Observability@Devoxx PL 2024Beginner's  Guide to Observability@Devoxx PL 2024
Beginner's Guide to Observability@Devoxx PL 2024
 
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical OperationsEnsuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
 
Streamlining End-to-End Testing Automation
Streamlining End-to-End Testing AutomationStreamlining End-to-End Testing Automation
Streamlining End-to-End Testing Automation
 
How GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdfHow GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdf
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
Hands-on with Apache Druid: Installation & Data Ingestion Steps
Hands-on with Apache Druid: Installation & Data Ingestion StepsHands-on with Apache Druid: Installation & Data Ingestion Steps
Hands-on with Apache Druid: Installation & Data Ingestion Steps
 
The Role of DevOps in Digital Transformation.pdf
The Role of DevOps in Digital Transformation.pdfThe Role of DevOps in Digital Transformation.pdf
The Role of DevOps in Digital Transformation.pdf
 
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery FleetStork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
 
What is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdfWhat is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdf
 
Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...
Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...
Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
 

How Firebird transactions work

  • 1. 1 1 Firebird Conference 2014, Prague © IBSurgeon How Firebird transactions work Dmitry Kuzmenko www.IBSurgeon.com
  • 2. 2 2 Firebird Conference 2014, Prague © IBSurgeon Thank you!
  • 3. 3 3 Firebird Conference 2014, Prague © IBSurgeon • Tools and consulting • Platinum Sponsor of Firebird Foundation • Founded in 2002: 12 years of Firebird and InterBase recoveries and consulting • Based in Moscow, Russia
  • 4. 4 4 Firebird Conference 2014, Prague © IBSurgeon Agenda What is transaction? Why we need it? How we will present about transactions Records and versions Transactions and record versions Transaction Inventory Record visibility in transactions Transaction Markers and their evaluation Some conclusions
  • 5. 5 5 Firebird Conference 2014, Prague © IBSurgeon What is transaction? • Transaction as a general concept of any dynamic system • “Classic” example • begin • -- move money from account1 to account2 • Decrease account1 • Increase account2 • end – commit/rollback • Transaction Managers
  • 6. 6 6 Firebird Conference 2014, Prague © IBSurgeon Database transaction definition • a unit of work performed against a database, and treated in a coherent and reliable way independent of other transactions. • A database transaction, by definition, must be Atomic, Consistent, Isolated and Durable
  • 7. 7 7 Firebird Conference 2014, Prague © IBSurgeon In ideal world Insert into T1(i1) values (100); SELECT i1 FROM T1 Insert into T1(i1) values (200); only serial operations
  • 8. 8 8 Firebird Conference 2014, Prague © IBSurgeon
  • 9. 9 9 Firebird Conference 2014, Prague © IBSurgeon
  • 10. 10 10 Firebird Conference 2014, Prague © IBSurgeon In real world Tx11 Tx14 INSERT T1 t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 commit UPDATE T1 nowait commit Tx20 UPDATE T1 rollback UPDATE T1
  • 11. 11 11 Firebird Conference 2014, Prague © IBSurgeon The ultimate purpose of transaction: • Concurrent execution of operations should lead to the exactly the same result as sequental execution of operations. In simple words: each transaction should run as the only transaction. For each [snapshot] transaction Firebird engine should maintain a stable view of the database.
  • 12. 12 12 Firebird Conference 2014, Prague © IBSurgeon
  • 13. 13 13 Firebird Conference 2014, Prague © IBSurgeon How Firebird does implement stable view for each transactions?
  • 14. 14 14 Firebird Conference 2014, Prague © IBSurgeon How we will present about transactions Start End Tx 11 Transaction’s number t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
  • 15. 15 15 Firebird Conference 2014, Prague © IBSurgeon How we will present about transactions Tx 11 commit Tx 12 rollback Transaction’s result Transaction’s result t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
  • 16. 16 16 Firebird Conference 2014, Prague © IBSurgeon How we will present about transactions Tx 11 commit snapshot Transaction’s parameters t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
  • 17. 17 17 Firebird Conference 2014, Prague © IBSurgeon How we will present about transactions Tx 11 commit Insert into T1(i1) values (100); snapshot Operation in the frames of transaction t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
  • 18. 18 18 Firebird Conference 2014, Prague © IBSurgeon How we will present about transactions Result of operation Tx 11 commit Insert into T1(i1) values (100); i1 100 SELECT i1 FROM T1 snapshot t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
  • 19. 19 19 Firebird Conference 2014, Prague © IBSurgeon Now let's start... Basics your [probably] know: - Everything in the database is done within transaction - Each transaction get it’s own incremented number 1, 2, 3, … etc - Firebird is a multi-version engine (each record in Firebird can have versions)
  • 20. 20 20 Firebird Conference 2014, Prague © IBSurgeon Record versions is a key thing for understanding transactions' work in Firebird.
  • 21. 21 21 Firebird Conference 2014, Prague © IBSurgeon How record versions appear Tx10 commit Insert into T1(i1) values (100); t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
  • 22. 22 22 Firebird Conference 2014, Prague © IBSurgeon How record versions appear Tx10 commit Insert into T1(i1) values (100); Tx50 t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 commit SELECT i1 FROM T1 i1 100
  • 23. 23 23 Firebird Conference 2014, Prague © IBSurgeon How record versions appear Tx10 commit Insert into T1(i1) values (100); Tx50 t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 commit SELECT i1 FROM T1 i1 100 Tx60 commit UPDATE T1 SET i1=200 new version!
  • 24. 24 24 Firebird Conference 2014, Prague © IBSurgeon How record versions appear Tx10 commit Insert into T1(i1) values (100); Tx50 i1 200 t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 commit SELECT i1 FROM T1 i1 100 SELECT i1 FROM T1 Tx60 commit UPDATE T1 SET i1=200 SELECT i1 FROM T1 i1 100
  • 25. 25 25 Firebird Conference 2014, Prague © IBSurgeon How it works?
  • 26. 26 26 Firebird Conference 2014, Prague © IBSurgeon Each record version has transaction # N on page Transaction number Datafield1, datafield2 1 50 100
  • 27. 27 27 Firebird Conference 2014, Prague © IBSurgeon TR50 read N Tx Data 1 10 100 ...
  • 28. 28 28 Firebird Conference 2014, Prague © IBSurgeon TR50 N Tx Data write TR60 1 10 100 ... read
  • 29. 29 29 Firebird Conference 2014, Prague © IBSurgeon TR50 N Tx Data TR60 1 10 100 60 200 ... read write
  • 30. 30 30 Firebird Conference 2014, Prague © IBSurgeon TR50 TR60 read N Tx Data 1 10 100 60 200 ... read write
  • 31. 31 31 Firebird Conference 2014, Prague © IBSurgeon Some intermediate conclusions 1. No “locks” are placed on the record 2. There can be a lot of committed versions for one record 3. Versions may be needed or not. If not, they can be considered as “garbage”. 4. Only one non-committed version can exist for the record (2 active transactions can’t update the same record)
  • 32. 32 32 Firebird Conference 2014, Prague © IBSurgeon How server knows about transactions states? Is transaction Active or not? •TIP – Transaction Inventory Pages • Linear list of transaction states, from 1 to last transaction number • Stored in the database • Limitation — 2 billions of transactions
  • 33. 33 33 Firebird Conference 2014, Prague © IBSurgeon Transaction states • Each transaction is represented in Transactions Inventory by it’s state • 00 – Active • 01 – Committed • 10 – Rolled back • 11 – Limbo (distributed 2-phase transactions) TIP contents Tx № Tx state … 10 committed 11 committed 12 committed 13 rolled back 14 committed 15 committed 16 committed 17 rolled back 18 active 19 committed 20 active
  • 34. 34 34 Firebird Conference 2014, Prague © IBSurgeon Tx10 commit Insert into T1(i1) values (100); Tx50 i1 200 t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 commit SELECT i1 FROM T1 i1 100 SELECT i1 FROM T1 Tx60 commit UPDATE T1 SET i1=200 SELECT i1 FROM T1 i1 100 TIP Tx State 10 Commited Tx State 10 Commited 50 Active 60 Active Tx State 10 Commited 50 Commited 60 Commited
  • 35. 35 35 Firebird Conference 2014, Prague © IBSurgeon Transaction isolation levels
  • 36. 36 36 Firebird Conference 2014, Prague © IBSurgeon IIssoollaattiioonn lleevveellss iinn FFiirreebbiirrdd Isolation levels in Firebird READ COMMITED SNAPSHOT SNAPSHOT WITH TABLE STABILITY
  • 37. 37 37 Firebird Conference 2014, Prague © IBSurgeon Snapshot Tx 51 rollback Insert into T1(i1) values (200); Tx 52 commit Insert into T1(i1) values (100); Tx 10 t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 commit SELECT FROM T1 SELECT FROM T1 snapshot i1
  • 38. 38 38 Firebird Conference 2014, Prague © IBSurgeon Read Commited Tx 15 commit Insert into T1(i1) values (100); Tx 10 t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 commit SELECT i1 FROM T1 SELECT i1 FROM T1 read commited i1 100 i1
  • 39. 39 39 Firebird Conference 2014, Prague © IBSurgeon Read Commited and Snapshot Read Committed transactions “see” global TIP. That’s why they can read committed changes of other transactions t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 Snapshot copies TIP on it’s start. It does not see any changes made by other committed transactions after snapshot start t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
  • 40. 40 40 Firebird Conference 2014, Prague © IBSurgeon TIP for Read Commited Tx 15 commit Insert into T1(i1) values (100); Tx 10 t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 commit SELECT i1 FROM T1 SELECT i1 FROM T1 read commited i1 100 i1 Tx State 10 Active Tx State 10 Active 15 Active Tx State 10 Active 15 Commited
  • 41. 41 41 Firebird Conference 2014, Prague © IBSurgeon Tx 51 rollback Insert into T1(i1) values (200); Tx 52 commit Insert into T1(i1) values (100); Tx 10 t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 commit SELECT FROM T1 SELECT FROM T1 snapshot i1 Tx State 10 Active Tx State 10 Active 51 Active 52 Active Tx State 10 Active 51 Rollback 52 Commited Tx State 10 Active TIP for snapshot
  • 42. 42 42 Firebird Conference 2014, Prague © IBSurgeon Each transaction can see: • Own created records and versions • Insert, Update, Delete • If it is Read Committed, it can see every changes that was made by committed transactions, because it looks into global TIP • If it is Snapshot, it can see own changes and record versions commited to the moment of its start, because it looks into it’s own copy of TIP
  • 43. 43 43 Firebird Conference 2014, Prague © IBSurgeon Record versions visibility
  • 44. 44 44 Firebird Conference 2014, Prague © IBSurgeon How we will present about records Each record can have versions, created by different transactions Record 10 Tx 10 100 Tx 20 200 Tx 30 555
  • 45. 45 45 Firebird Conference 2014, Prague © IBSurgeon How we will present about records Record 10 Tx 10 100 Tx 20 200 Tx 30 555 Compact representation R10 Tx 10 Tx 20 Tx 30
  • 46. 46 46 Firebird Conference 2014, Prague © IBSurgeon 3 rules of record visibilty 1) For each snapshot transaction engine maintains stable view of database 2) Transaction can not see record versions created by another active transaction 3) Transaction should walk backversions chain looking for commited backversion
  • 47. 47 47 Firebird Conference 2014, Prague © IBSurgeon Ex: record versions visibility for Tx20 Snapshot isolation, copy of TIP for Tx20
  • 48. 48 48 Firebird Conference 2014, Prague © IBSurgeon • In order to figure out which record version is visible, every transaction must read TIP • TIP can contain up to 2 Billion transactions • So each transaction should read up to 2 billions of transactions! - Damn, that's why Firebird is slow! (it's a joke)
  • 49. 49 49 Firebird Conference 2014, Prague © IBSurgeon TIP (example) We need a way to separate old, not interesting transactions from currently active part of TIP ● For this purpose engine maintains Oldest Interesting Transaction marker, or OIT
  • 50. 50 50 Firebird Conference 2014, Prague © IBSurgeon TIP (example)
  • 51. 51 51 Firebird Conference 2014, Prague © IBSurgeon
  • 52. 52 52 Firebird Conference 2014, Prague © IBSurgeon Transaction markers firebird>gstat -h A.FDB Database header page information: Flags 0 Generation 6 System Change Number 0 Page size 4096 ODS version 12.0 Oldest transaction 1 Oldest active 2 Oldest snapshot 2 Next transaction 3 Sequence number 0 Next attachment ID 3
  • 53. 53 53 Firebird Conference 2014, Prague © IBSurgeon 4 markers • Transaction markers are key characterstics of TIP and transaction mechanism – Let's see what they mean and how they evaluated: • NEXT — next transaction • OAT — Oldest Active • OST — Oldest Snapshot • OIT — Oldest Interesting
  • 54. 54 54 Firebird Conference 2014, Prague © IBSurgeon NEXT • NEXT is the simplest — it's the most recent transaction • NEXT number is written on header page
  • 55. 55 55 Firebird Conference 2014, Prague © IBSurgeon OAT - Oldest Active Transaction OAT is the first transaction in TIP which state is “active” Evaluation: ● Scan TIP starting from current OAT value looking for “active” transaction ● Save found value in transaction's lock data ● Save found value as new OAT marker OAT is really an oldest active transaction
  • 56. 56 56 Firebird Conference 2014, Prague © IBSurgeon OAT evaluation example
  • 57. 57 57 Firebird Conference 2014, Prague © IBSurgeon Problems indicated by OAT ● Where to look? ● NEXT — OAT > (number of connections * number of transaction) ● What it means? ● Long running transaction which makes Firebird to think that record versions are still needed
  • 58. 58 58 Firebird Conference 2014, Prague © IBSurgeon
  • 59. 59 59 Firebird Conference 2014, Prague © IBSurgeon
  • 60. 60 60 Firebird Conference 2014, Prague © IBSurgeon
  • 61. 61 61 Firebird Conference 2014, Prague © IBSurgeon OST and Read Commited transactions
  • 62. 62 62 Firebird Conference 2014, Prague © IBSurgeon
  • 63. 63 63 Firebird Conference 2014, Prague © IBSurgeon UPDATE T1 UPDATE T1 UPDATE T1 UPDATE T1 UPDATE T1 N Tx Data 1 4 ccc 2 1 aaa 3 2 bbb 4 3 bbbb 5 6 7 ... Select * from write rdb$database t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 The longer transaction lasts, the higher chance to create potentially useless (potential garbage) versions
  • 64. 64 64 Firebird Conference 2014, Prague © IBSurgeon Problems indicated by OST Where to look (OST-OIT) > sweep interval What it means – Autosweep does not work (if sweep interval >0) – Some records need garbage collection
  • 65. 65 65 Firebird Conference 2014, Prague © IBSurgeon Problems caused by long running transactions • Direct • Loss of performance due to more record versions: i.e., queries become slower • More indexed reads • More data page reads • 1.5mln versions ~30mb per record • Indirect • After transaction’s end its versions become garbage, and garbage collection mechanism tries to gather it • Due to long transaction OST stuck, so autosweep (if it is not disabled) tries to start at unpredictable moment (and ends without success) • GC and sweep can consume a lot of resources • Unpredictable moment can occur at high load time
  • 66. 66 66 Firebird Conference 2014, Prague © IBSurgeon Oldest Interesting Transaction
  • 67. 67 67 Firebird Conference 2014, Prague © IBSurgeon TIP size • TIP to be copied is NEXT - OIT • Size of active part of the TIP in bytes is (Next – OIT) / 4
  • 68. 68 68 Firebird Conference 2014, Prague © IBSurgeon
  • 69. 69 69 Firebird Conference 2014, Prague © IBSurgeon Problems indicated by OIT Where to look OIT- OST Problem Big size of TIP — Global, and, specifically copies of TIP for snapshots
  • 70. 70 70 Firebird Conference 2014, Prague © IBSurgeon Ideal transactions flow TxNN TxNN TxNN TxNN TxNN TxNN TxNN TxNN Short transactions does not stuck OIT or OAT or OST, and avoid problems related with it. Oldest transaction X-1 Oldest active X Oldest snapshot X Next transaction X+1 t0 t1 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
  • 71. 71 71 Firebird Conference 2014, Prague © IBSurgeon Summary • Make write (for INSERT/UPDATE/DELETE) transactions as short as possible • Use Read Commited Read-Only transactions for SELECTs
  • 72. 72 72 Firebird Conference 2014, Prague © IBSurgeon Thank you! • Questions? support@ib-aid.com