Recent

Author Topic: SQLDB Transaction isolation level settings  (Read 8823 times)

patyi

  • Full Member
  • ***
  • Posts: 168
SQLDB Transaction isolation level settings
« on: September 22, 2011, 11:20:58 pm »
Hi all !

One interesting question, that I don't find on the forum, nor in documentation :
Howe can I set the transaction isolation level for Firebird 2.5 in
SQLDB Transaction components Params property ?  :o
For example to ReadCommited !?
What is the default isolation level for SQLDB ?
(if it is ReadCommited then I'm happy ! if not then ...  :'()

Can I use more then one transaction component / connection ?
 
(Lazarus latest SVN, FPC 2.7.1 latest SVN, Firebird 2.5, Ubuntu 11.04)

Regards : Patyi
 

Lacak2

  • Guest
Re: SQLDB Transaction isolation level settings
« Reply #1 on: September 23, 2011, 06:33:29 am »
Yes you can use Params property and there you can set:
"isc_tpb_read_committed"
with conjuction with otheres like:
"'isc_tpb_wait" etc.

Zoran

  • Hero Member
  • *****
  • Posts: 1990
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: SQLDB Transaction isolation level settings
« Reply #2 on: September 29, 2011, 12:05:18 am »
Yes you can use Params property and there you can set:
"isc_tpb_read_committed"
with conjuction with otheres like:
"'isc_tpb_wait" etc.

Could you please write an example of what shoud be exactly put in Params to set the transaction isolation level to read committed? Thank you.
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

patyi

  • Full Member
  • ***
  • Posts: 168
Re: SQLDB Transaction isolation level settings
« Reply #3 on: September 29, 2011, 07:50:14 am »
Hi !

Transaction parameters for READ COMMITED is in theory should bi :

isc_tpb_read                          - read permission
isc_tpb_write                          - write permission
isc_tpb_read_committed     - transaction isolation level
isc_tpb_wait                           - if another transaction is use the record then wait
isc_tpb_rec_version             - keep old record versions

This transaction isolation level is best for short transactions !

I need confirmation of this from Firebird expert ...

Thanks, Patyi.

Zoran

  • Hero Member
  • *****
  • Posts: 1990
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: SQLDB Transaction isolation level settings
« Reply #4 on: September 29, 2011, 08:51:59 am »
If I am not mistaken, Params property is a list of lines which should have param=value form. I don't know what to put there — something=isc_tpb_read_commited?
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

Lacak2

  • Guest
Re: SQLDB Transaction isolation level settings
« Reply #5 on: September 30, 2011, 07:21:40 am »
Write per line:
isc_tpb_read_commited
isc_tpb_wait

(so no "key"="value", only "values" per line)

Zoran

  • Hero Member
  • *****
  • Posts: 1990
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: SQLDB Transaction isolation level settings
« Reply #6 on: September 30, 2011, 08:53:08 pm »
Thank you!
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: SQLDB Transaction isolation level settings
« Reply #7 on: October 10, 2011, 06:15:25 pm »
Hi all,

Thanks for the info above.
I've started to note it down in the wiki:
http://wiki.lazarus.freepascal.org/Firebird_in_action#Advanced_transactions
but couldn't figure out the other isolation levels.

Help in updating the info there (or additional links) very welcome.

Also, as long as I have your attention: I'm trying to speed up a query on a couple of tables in a Firebird 2.5 embedded database. My connection/transaction/query is the only one and it can have read-only access. In other words, I don't care about updates etc.
What is the best combination of settings to use?
Thanks.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Lacak2

  • Guest
Re: SQLDB Transaction isolation level settings
« Reply #8 on: October 11, 2011, 07:28:48 am »

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: SQLDB Transaction isolation level settings
« Reply #9 on: October 11, 2011, 10:00:55 am »
Thanks, that helps, updated the wiki.
Now I found the various transaction isolation levels, and a mapping of all parameters.

As for my question regarding my db, am I correct in this assessment:
  • Read committed: will have overhead looking for other commits - but I'm the only transaction on that embedded db, so will probably be slower than snapshot
  • Snapshot: I don't need read committed, as there won't be any other commits. Perhaps snapshot gives better performance
  • Consistency: might be the best option; I could just lock all tables involved (or all tables in the db for that matter)
« Last Edit: October 11, 2011, 11:21:28 am by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018