InnoDB frequently updated table running slow <p>I have a very simple table to track users activity. It's structure is as following:</p> <pre><code>userId appId lastActivity PRIMARY(userId, appId) </code></pre> <p>Table allows to track, if user is active within a specific application. It's updated once a minute for each user and read as frequently to count number of users online within a specific application.</p> <p>Lately I've noticed, that updates took a while to perform:</p> <pre><code>2012-10-01 16:49:10 - WARN --&gt; Heavy query; array ( 'caller' =&gt; 'updateActivity', 'query' =&gt; 'INSERT INTO user_activity VALUES(4953, 1, 1349095750) ON DUPLICATE KEY UPDATE lastActivity = 1349095750', 'elapsed' =&gt; 0.134618, ) 2012-10-01 18:26:06 - WARN --&gt; Heavy query; array ( 'caller' =&gt; 'updateActivity', 'query' =&gt; 'INSERT INTO user_activity VALUES(4533, 1, 1349101566) ON DUPLICATE KEY UPDATE lastActivity = 1349101566', 'elapsed' =&gt; 0.581776, ) 2012-10-01 18:27:16 - WARN --&gt; Heavy query; array ( 'caller' =&gt; 'updateActivity', 'query' =&gt; 'INSERT INTO user_activity VALUES(5590, 1, 1349101636) ON DUPLICATE KEY UPDATE lastActivity = 1349101636', 'elapsed' =&gt; 0.351321, ) 2012-10-01 20:54:32 - WARN --&gt; Heavy query; array ( 'caller' =&gt; 'updateActivity', 'query' =&gt; 'INSERT INTO user_activity VALUES(3726, 1, 1349110472) ON DUPLICATE KEY UPDATE lastActivity = 1349110472', 'elapsed' =&gt; 0.758706, ) </code></pre> <p>Table uses InnoDB as storage engine.</p> <p><strong>My questions</strong></p> <ol> <li><p>Is there any problem at all?</p></li> <li><p>Is there any problem in my design?</p></li> <li><p>Where to start to find performace problems in this specific situation?</p></li> </ol>