0

Giving SQL SELECT Priority over SQL INSERT/UPDATEs in MySQL

Let us say you have a table that is being read a lot and updates (SQL INSERT and UPDATE) are occassional or initiated by some asynchronous operations (e.g., Message-driven beans). Furthermore, you consider the reads more important than the updates.  How could we give read requests priority over update requests?

Here are the general ways to do it. In a nutshell, updates are delayed until no other clients are reading from the table. It is also worth noting that these constructs have their own limitations and disadvantages – both usage and performance. So, do not use them just to be fancy. For instance, INSERT DELAYED does not work with InnoDB. In addition to that, additional load may be added to the server.

SQL SELECT

or

SQL INSERT or UPDATE