简体   繁体   中英

Perl DBI - Parallel Transactions

I have a perl script with DBI doing various DML operations on multiple tables in a MySQL database in a sequence.

I implemented transactions using dbh->begin_work and eval in my perl script. Now, I ran my script once and after some time I ran it again thereby initiating two transactions to my database. By the time, I ran the script for second time, the first transaction had completed operations on the fifth table yet my second transaction waits to do operations even on the first table.

Can I make the script get executed in parallel so that second transaction can be able to perform operations on the first table while the first transaction is working ahead of it?

Every database has its own transaction isolation levels. Read something like this article: http://www.oracle.com/technetwork/issue-archive/2005/05-nov/o65asktom-082389.html

So every transaction may be locked and/or abandoned due to race conditions between simultaneous running transactions.

And read http://search.cpan.org/~timb/DBI-1.636/DBI.pm#Transactions chapter to use RaiseError anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM