简体   繁体   中英

Update and read table at the same time?

I have a requirement that I need to update a MySQL table continuously and at the same time read the table for use. Dirty read is acceptable. Is this operation permitted in MySQL? What do I need to do this operation in a Java program?

Sure, you just need to have transactions that query the and transactions that update the DB. These can be in different/same threads or processes. If dirty reads are acceptable, make sure your isolation level in MySQL is READ UNCOMMITTED. To understand the importance of isoation levels, see:

http://en.wikipedia.org/wiki/Isolation_%28database_systems%29

To set this in MySQL:

http://dev.mysql.com/doc/refman/5.0/en/set-transaction.html

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