Rails SELECT 40001 SQL_NO_CACHE fired from unknown place

家住魔仙堡 提交于 2019-12-01 08:23:42

问题


In MySQL DB server we have schema named test. The schema has table named users.

The table users not used in any place by rails application. The only place the entry for users found is in schema.rb.

The users tables has some data stored and data gets inserted by another java application which runs on some other server. The rails application makes API call to JAVA application via HTTPs and retrieves the data for usage if needed.

Daily the MySQL Master DB gets replicated to Slave server.

During replication the bellow query getting logged in slow logs and its making replication lag.

root    localhost   test Query  93  Sending data    SELECT /*!40001 SQL_NO_CACHE */ * FROM `users`
root    localhost   test Query  62  Writing to net  SELECT /*!40001 SQL_NO_CACHE */ * FROM `users`

This query is not fired from Rails application - we can see the user and host of the connection in logs is root and localhost.

I would be very grateful if someone helps me to identify origin of the query and how can or what can be done to avoid query.


回答1:


I had the same problem. In my case it was due to calling mysqldump.



来源:https://stackoverflow.com/questions/41278597/rails-select-40001-sql-no-cache-fired-from-unknown-place

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!