Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How simultaneous queries are handled in a MySQL database?

I am using MySQL database and I would like to know if I make multiple (500 and more) queries simultaneously in order to get information from multiple tables, how these queries are handled? Sequentially or in parallel?

like image 771
user502052 Avatar asked Feb 12 '11 21:02

user502052


1 Answers

Queries are always handled in parallel between multiple sessions (i.e. client connections). All queries on a single connections are run one-after-another. The level of parallelism between multiple connections can be configured depending on your available server resources.

Generally, some operations are guarded between individual query sessions (called transactions). These are supported by InnoDB backends, but not MyISAM tables (but it supports a concept called atomic operations). There are various level of isolation which differ in which operations are guarded from each other (and thus how operations in one parallel transactions affect another) and in their performance impact.

For more information read about transactions in general and the implementation in MySQL.

like image 150
Holger Just Avatar answered Oct 06 '22 00:10

Holger Just