When I run automated tests against my test_development
database, I often observe degraded performance for my production users, even though those users aren't accessing the same database as the test suite. In viewing the process list, it seems that the degradation corresponds to frequent TRUNCATE TABLE
statements which run on the test db (to reset the db state for the next test). I see a system lock for the TRUNCATE TABLE
statement, and I see "Waiting for query cache lock" for the production users. Here is part of my process list:
mysql> show full processlist\G
*************************** 8. row ***************************
Id: 67503075
User: delivery
Host: xxxxxxxxxxx:34734
db: test_development
Command: Query
Time: 0
State: System lock
Info: TRUNCATE `change_version`
*************************** 12. row ***************************
Id: 67503141
User: delivery
Host: xxxxxxxxxxx:37959
db: delivery
Command: Query
Time: 0
State: Waiting for query cache lock
Info: SELECT COUNT(*) FROM `address_single_4` WHERE `address_single_4`.`reportId` = 75483054
12 rows in set (0.04 sec)
Why is the TRUNCATE TABLE
statement (apparently) blocking queries that are not in the same database, and how can I fix it?
I am on MySQL 5.6.21, running in Amazon RDS. All tables are InnoDB.
query_cache_size
to no more than 50M.