If I have a php script which calls INSERT, UPDATE, DELETE, etc on a MySQL connection, and that script gets called at uncontrolled times by a POST operation, is it always “safe” (ie, will not result in corrupt tables or collisions during requests)?
For example, if 500 requests come during a 1-second period.
If so, how does php/mysql achieve this?
If not, what does one need to do to guarantee “serial” access or safe simultaneous access?
MySQL uses locking (table-level for MyISAM or row-level for InnoDB), which does not allow 2 processes (2 calls to the script) to modify the same row. So the table won’t crash*, but it’s possible that MySQL can’t handle the number of request in reasanoble time and the requests will wait. You should always optimize your queries to be as fast as possible.
*MyISAM could crash on insert/update intensive applications, but it has automatic recovery. However keep in mind that in such application, InnoDB has far better performance