An index that helped one customer and cost everybody

An index added for a customer whose data shape is an outlier, and the write cost it imposed on every insert.

the index: (customer_id, status, placed_at, total)
added for one customer with 200,000 orders.

  their query        4.1s → 40ms
  everybody else     unchanged (they use a shorter
                     index that already existed)
  every INSERT       +0.4ms, on 41,000 a day
  disk               +1.8 GB

41,000 × 0.4ms = 16 seconds a day of write time, to
save one customer 4 seconds twice a day.

The arithmetic favours the index and it is closer than it looked, and the version that is clearly right is a partial index — which MySQL does not have. A filtered index on the one customer would cost nothing on the other rows, and the workaround, a generated column that is null except for them, was judged too clever to maintain.