Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I am running a very intensive MySQL query and noticed that only 1 core is being used to 100% while the other cores are idle. The system is running Ubuntu 12.04 and MySQL 5.5.28

Is there a way to force MySQL to use all cores?

enter image description here

share|improve this question

migrated from Mar 4 '13 at 10:22

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Phil, Leigh Riffel, Mark Storey-Smith, RolandoMySQLDBA, Marian Mar 5 '13 at 14:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Why php was tagged here? – Abimaran Kugathasan Mar 4 '13 at 10:18
I'm using PHP to run the SQL queries. – Nyxynyx Mar 4 '13 at 10:18

MySQL's implementation won't allow you to use more than one core per Server Thread.

I recommend divide-and-conquer strategy: break up your query in multiple (hopefully smaller, independent) jobs and start again.

share|improve this answer
MySQL 5.5 does allow multiple read and write IO threads. So does 5.1's InnoDB Plugin (starting for MySQL 5.1.38). I left comments in the question to my posts on this. However, I will give a +1 because your answer would only apply to anyone who wants to stick to versions of MySQL prior to 5.1.38, or any version of MySQL after 5.1.38 that does not have the InnoDB Plugin installed. Here is a youtube video that shows divide-and-conquer strategy using multiple mysqld processes (… ). I used to recommend this. – RolandoMySQLDBA Mar 4 '13 at 16:37
@RolandoMySQLDBA I believe there's a misunderstanding here. MySQL won't divide a single query's work between different Server Threads, and one Server Thread won't ever use more than one CPU core at any given point-in-time. Therefore, if (as the question states) there's only one query to run, the maximum number of CPU cores a MySQL Server can get working on the problem is 1: one thread must take care of the query, and one CPU core will be used to run the process. – LMC Mar 5 '13 at 13:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.