MySQL Forums
Forum List  »  General

Re: Is it best practice to lock table for every Mysql query?
Posted by: Craig Liu
Date: December 21, 2018 11:56AM

Peter Brawley Wrote:
-------------------------------------------------------
> > Assume we use MySQL MyIsam tables and php coding
> for websites in which the database are frequently
> read and update.
>
> Bad start. For a multi-user context like that
> where read consistency is desired, you need InnoDB
> and all updates in transaction blocks.
>
> > can we run the query without lock all tables for
> READ and in the meantime ensure the results of
> SELECT is right?
>
> No. You're taking a snapshot, there are no
> guarantees an object in the pic isn't moving.

Thank Peter, InnoDB is a way to go, but our software is aged software.

Even for a pure Select query (may be a complex query including many join), we have to lock tables for read? Can you explain more or give me a link?

Options: ReplyQuote




Sorry, only registered users may post in this forum.

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.