When I run a large MySQL query that inserts 50k records (with 10 small columns) into the database, my query cache usage spikes from around 10MB to 400MB. Is MySQL caching my insert?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As another user stated, there is a mechanism in MySQL which keeps the cache up to date. When you perform an INSERT which affects previously stored results in the cache, it must either be updated to reflect the new insert, or removed, to be created again later when that SELECT is processed again. I suspect this is what you are seeing.
Another possibility, although more obvious, and hopefully not your issue, is that if you are performing this INSERT with a tool which displays and automatically updates the table, it may be issuing SELECTS after you INSERT.