A few weeks back, I was working on a customer issue wherein they
were observing database performance that dropped through the
floor (to the point of an outage) roughly every 4 weeks or so.
Nothing special about the environment, the hardware, or the
queries; really, the majority of the database was a single table
with an auto-incrementing integer PK and a secondary UNIQUE KEY.
The queries being run against this table were almost exclusively
INSERT … ON DUPLICATE KEY UPDATE (INSERT ODKU), with the columns
from the INSERT part of the statement corresponding to the
columns in the secondary index, and they were coming in at a rate
of approximately 1500 to 2000 per second, sustained, 24h per day.
The mathematically-astute among you may already be able to see
where this is going.
For purposes of discussion, we can use the following table to
illustrate the situation:
CREATE TABLE update_test (
id INT UNSIGNED NOT NULL …
[Read more]