I have a single database server with 4 cores and a web server running PHP. I want one PHP script to be able to issue queries to the database server such that they execute in parallel on the database server, one on each mysqld process. Typically in PHP you do this:
$sql = new mysqli( [insert connection parameters] );
$sql->query( "SELECT 'Complex Query A'" );
$sql->query( "SELECT 'Complex Query B'" );
$sql->query( "SELECT 'Complex Query C'" );
$sql->query( "SELECT 'Complex Query D'" );
But these run serially and only utilize one mysqld process. In this application, each query (A through D) is processing a different part of the data, but working on the same set of InnoDB tables.
One possible solution is to make AJAX calls to apache to break it down into sub-scripts that might run in parallel, but I'm guessing that Apache will process those ajax calls sequentially with one httpd process per client.
Is there a way to achieve this? Does anyone have experience with the mysqlnd MYSQLI_ASYNC features? Can they work in parallel with a single database server and mysqli connection?
Purpose: we run real-time analytic tools that generate graphs and I'd like to take advantage of the processing power on our database to speed up the queries which take time.