Does php need to use mysql lock?
Under normal circumstances, MYSQL will automatically add tables during update operations Lock. No explicit locking is required. Unless the data requires strict logical writing order.
Before executing the query statement (SELECT), read locks will be automatically added to all tables involved. Before update operations (UPDATE, DELETE, INSERT, etc.) are performed, write locks will be automatically added to the tables involved. This The process does not require user intervention. Therefore, users generally do not need to directly use the LOCK TABLE command to explicitly lock the MyISAM table.
Related introduction:
Page level: Engine BDB.
Table level: engine MyISAM, understood as locking the entire table, which can be read at the same time, but cannot be written
Row level: engine INNODB, a single row of records is locked
1 ) Table-level lock: low overhead, fast locking; no deadlock; large locking granularity, the highest probability of lock conflict, and the lowest concurrency.
2) Row-level locks: high overhead, slow locking; deadlocks may occur; the locking granularity is the smallest, the probability of lock conflicts is the lowest, and the degree of concurrency is also the highest.
3) Page lock: The cost and locking time are between table locks and row locks; deadlocks will occur; the locking granularity is between table locks and row locks, and the concurrency is average.
Recommended tutorial: PHP tutorial
The above is the detailed content of Does php need to use mysql lock?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version
Visual web development tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

WebStorm Mac version
Useful JavaScript development tools
