Inserting many table entries at the same time in PHP and MySQL
I just finished programming a plattform on PHP that uses MySQL to save the results of a poll. I will be doing the poll with a group of 24 users that will submit the form at more or less the same time. So that the 开发者_如何学Cmysqli_query()
function will be executed around 24 times at the same time.
Is this a problem?
Should I worry about the function blocking the access to the db, or is themysqli_query()
safe to use without having to worry about blocking?In general no, unless you are doing something very interesting in the application logic that requires the data from another row. For example if you are using an ID it should be of the auto increamenting type, pretty standard stuff. You know you are ok if you are are only doing an insert and no select before hand and don't have a crazy stored proc on the database, which you likely do not.
mysql_queries will executed by order in which they arrived to mysql server. You can don't worry about it
精彩评论