There is often a need to run queries in the background in MySQL.
This generally is accomplished using a message queue (like
gearman), or by using extensions to a client (PHP has such
extensions) or by using MariaDB's native async query interface (C
client only I think).
While such solutions work well, they don't work for say a GO
client, or for the mysql command line client itself.
I present "async"; part of the Swanhart Toolkit (http://github.com/greenlion/swanhart-tools). Async
is a stored procedure and event based solution for asynchronous
queries.
It consists of:
-
- A queue table to hold the SQL to run, the state of execution,
error messages, etc
- A settings table that controls the number of parallel threads
to use for executing queries
- A stored routine …