learnedbyerror has asked for the wisdom of the Perl Monks concerning the following question:
I am continuing in my journey with DBIX::Class. Honestly, I am not sure that I see as much, if any, value in it relative to straight perl and DBI; however, I know enough to know that you sometimes cannot see value until you work at it long enough. So ...
My testbed is an application that hits various public web services to collect information and store it in a SQLite database. I have quite a bit working functionally at this time; however, insert performance into the database is horrible with the default of Auto_Commit = 1. My test code shows almost a 100X improvement if I went to native DBI and used transactions comitting every 1000 records in a total of 750K records.
My quandry, err question, lies into how best use transactions with DBIX::Class. The online documentation almost reads like we support transactions, but don't use them because our code is wonderful. But if you do use them, keep Auto_Commit = 1 and use the DBIX::Class::Schema txn_do method and we will still do wonderful things. And lastly, if this doesn't work for you, you can use txn_begin, txn_commit and txn_rollback but its absolutely you fault, which it is anyway, if anything goes wrong.
When performing a large number of inserts or updates with DBIX::Class, what is the fastest, recommend pattern to use?
I like the thought of txn_do for applications that don't have the speed criticality above; however, I cannot find much documentation on the advantages and disadvantages of it. I seem to only find the module documentation or snippets of it reformatted. Are there any good reads on this method?
Thanks in advance,
lbe
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBIX::Class and transactions
by moritz (Cardinal) on Apr 06, 2011 at 13:03 UTC | |
by learnedbyerror (Monk) on Jul 14, 2011 at 11:28 UTC | |
|
Re: DBIX::Class and transactions
by Your Mother (Archbishop) on Apr 06, 2011 at 14:01 UTC | |
|
Re: DBIX::Class and transactions
by duelafn (Parson) on Apr 06, 2011 at 20:30 UTC |