Thesql multi threading for a single query

linuxMySQLUbuntu

I have big db of size 8GB and having 9 million contacts in this db. When we try to retrieve all contacts, it takes nearly 1 or 2 hour (in some cases result in timeout) to retreive all contacts for the excecution for a single query. Also I have 8 CPU and 24GB RAM, Xeon Processor, the mysql process won't distribute accross the 8 CPU's. My question is that, does we can enable multi threading for a single query.

Awaiting for your Reply

Best Answer

Neither MyISAM nor InnoDB have multithreaded query implementation. Nor do other XtraDB, TokuDB. It is a long standing issue and limitation of MySQL. I don't know that the limitation is within the MySQL server, but rather in the storage engine implementation. No one ever did it...

I'm currently evaluating the column-store InfiniDB and Infobright IEE. They both support multi-cpu queries and the difference is overwhelming (due to multiple reasons, but CPU being obvious one).

You might want to look at Shard Query, a proxy to MySQL which splits your query into multiple queries, executes them on parallel processes and returns the aggregated result.