Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebird read-only transaction

What is the advantage of using Firebird read-only transaction? I am working with Firebird databases more than seven years. I have never used this option. I am just curious what is typical scenario for this feature? I am working with Firebird 2.5.x but if you have useful insight related to Firebird 3.x (or newer versions) your comments are welcome.

like image 526
truthseeker Avatar asked Jan 27 '26 01:01

truthseeker


2 Answers

The main advantage of read-only transaction in Firebird is that such transaction is not holding record versions. So the garbage collector could sweep them effectively.

Also, as it was mentioned above, a read-only transaction will never block other transactions.

In order to provide maximal performance and minimize risk of transaction deadlock application should use short updating transactions and one long living read only transaction (READ COMMITTED, REC VERSION) for reading data.

like image 163
Andrej Kirejeŭ Avatar answered Jan 31 '26 02:01

Andrej Kirejeŭ


While the transaction is in effect you see a consistent view of the database - data modifications (deletes/updates/inserts) from other connections or sessions won't be visible.

Common to use for combined reports where you run multiple queries against the same data to show it in different ways. If each query ran independently the reports might not agree with each other as latter queries could see different data.

Not specific to Firebird - read only transactions is a common database phrase you can search on for more information.

like image 36
Brian Avatar answered Jan 31 '26 04:01

Brian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!