从未知位置触发Rails SELECT 40001 SQL_NO_CACHE [英] Rails SELECT 40001 SQL_NO_CACHE fired from unknown place

查看:255
本文介绍了从未知位置触发Rails SELECT 40001 SQL_NO_CACHE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MySQL数据库服务器中,我们有一个名为 test 的架构.该架构具有名为用户的表.

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

Rails应用程序未在任何地方使用表用户.找到的 users 条目的唯一位置是schema.rb.

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

用户表中存储了一些数据,并且数据被运行在其他服务器上的另一个Java应用程序插入. Rails应用程序通过HTTP对JAVA应用程序进行API调用,并在需要时检索数据以供使用.

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.

每天将MySQL主数据库复制到从服务器.

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`

不会从Rails应用程序中触发此查询-我们可以看到日志中连接的用户和主机是root和localhost.

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.

推荐答案

我遇到了同样的问题.就我而言,这是由于调用了mysqldump.

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

这篇关于从未知位置触发Rails SELECT 40001 SQL_NO_CACHE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆