Q&A

Q1:Why do I need to be concerned about table locks and transaction-safe tables?
A1: Locks and transaction-safe tables are important in a multithreaded environment, in which client threads have the job of updating, inserting into, or deleting from the database. If it's important for a thread to perform a sequence of queries and always have a consistent view of the data, consider using locks or transaction-safe tables.
Q2:Is it better to use table locks or transaction-safe tables?
A2: If you have a low-traffic system in which there's little contention for getting locks (in other words, clients seldom have to wait), locks may be easier to implement. You can also use the default table type, MyISAM.

In systems with high traffic, in which waiting time for locks impedes performance, it is advantageous to use transaction-safe table types. These are designed for high performance with large volumes of read and write queries.

Q3:When should I use cooperative locks?
A3: Think of cooperative (or advisory) locks as more a way of communicating a lock situation between applications, or instances of the same application. MySQL acts as a sort of messenger between applications.

They do not make MySQL lock tables and only take effect when applications honor the state of the lock in a co-operative way: waiting for it to be freed and making sure that they obtain a lock before proceeding.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.248.69