Is it best practice to lock table for every Mysql query?
Posted by:
Caigen Liu
Date: December 20, 2018 11:24AM
This is a question quizzing me:
Assume we use MySQL MyIsam tables and php coding for websites in which the database are frequently read and update.
Now we have a SELECT MySQL query. Usually we lock all tables for READ, run the query, then unlock tables. My question is, can we run the query without lock all tables for READ and in the meantime ensure the results of SELECT is right?
For a website software in which the database tables need frequent read and update, can we only lock tables for WRITE if the MySQL query changes database tables e.g. delete/update/insert? And don't lock tables if the MySQL query is "SELECT"? If this question's answer is "yes", why we need "READ" lock?
Hope any professional opinions and thoughts. Thanks.
Subject
Written By
Posted
Is it best practice to lock table for every Mysql query?
December 20, 2018 11:24AM
December 21, 2018 11:13AM
December 21, 2018 11:56AM
December 21, 2018 01:08PM
December 21, 2018 01:41PM
December 21, 2018 01:58PM
December 21, 2018 03:03PM
December 21, 2018 06:46PM
December 27, 2018 09:55AM
December 27, 2018 11:01PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.