0

So, at my work we have a master and a slave going in replication, and we have a tracking table that gets hammered, lots of inserts with an 'ON DUPLICATE KEY UPDATE' clause. The table is InnoDB, so it locks on the row level. I have this one query that selects data from the stuff currently being written to, but it behaves differently on the master vs the slave, namely that on the master it'll never finish and on the slave it'll finish instantly, and want to know why.

I can understand that the query would have issues dealing with the volatile rows that are being updated, but that's also happening on the slave, albeit at more regular intervals.

SELECT SUM(hits) AS hits, DATE(`when`) AS thedate
FROM tracking tr
WHERE tr.geo_country IN('FR') 
AND tr.`when` BETWEEN '2013-08-23 00:00:00' AND '2013-08-23 23:59:59'
GROUP BY thedate

No locking is happening on either server, none other than on a single row basis that can't be seen by show processlist.

4

0 回答 0