This morning our aurora mysql serverless 2 spiked and basically locked up. We have a writer/reader and a reader associated with the cluster.
On the reader we had an intense select query. This is the query RDS shows (field names changed), the point is it has multiple FIND_IN_SET functions and insights show it examined 109826.50 rows.
SELECT thisstuff
( thistime
) AS thestuff
, COUNT ( * ) AS count
FROM mytable
WHERE todo
= ?
AND someID
= ?
AND
( ( FIND_IN_SET
( otherID
, ? ) ) ||
( FIND_IN_SET
( otherID
, ? ) ) ||
( FIND_IN_SET
( otherID
, ? ) ) )
AND ( thistime
BETWEEN ? AND ? )
AND some_status
= ?
GROUP BY months_todo
( thistime
)
At the same time our writer had the following waits going on.
wait/io/redo_log_flush
synch/sxlock/innodb/hash_table_locks
wait/io/table/sql/handler
Can somebody please help me understand why this happened, as in did the writer lock the tables or did the FIND_IN_SET lock the writer? The writer was making updates to the same table at the time the query was going on. Is there a way to prevent this?
Thank You