title: MySQL - High CPU long after executing update
body: <p>I have a MySQL database running in Amazon RDS that serves a  site. Around 80MB of data in one of the tables gets replaced hourly. I load the data into another table and then use rename to swap the tables and then delete the other table. </p>
  
  <p>Most of the time everything is fine. When the update happens hourly, there is a CPU spike to around to 10% and back to 2% or 3%, which is the CPU consumption with normal site traffic. </p>
  
  <p>Once in a while (no pattern), however, the CPU spikes to almost 100% right at the time of the update and stays very high until the next update an hour later, long after the update is completed. The update takes seconds. During the entire hour, traffic to the site is normal. Also, during that time, <code>show processlist</code> is empty - no stuck processes.</p>
  
  <p>A couple of times, I manually triggered the update before the hour ended and the CPU went back to normal.</p>
  
  <p>My question is this: Assuming there is something inefficient going on with the data loading, <strong>can a bad query or update cause the CPU to stay high long after it completes executing</strong>? </p>
  
  <p>I will run <code>SHOW ENGINE INNODB STATUS</code> next time it happens. When I do, what should I be looking for?</p>
  
  <p>Some details if useful: </p>
  
  <ul>
  <li>RDS m4.large instance running in multi-az</li>
  <li>MySQL version 5.6.27</li>
  <li>InnoDB engine</li>
  <li>Connection pool used with default 8 connections</li>
  </ul>