I have following queries from rails logs
我有来自rails日志的以下查询
-
Called to database
叫做数据库
Userdetail Load (0.1ms) SELECT `userdetails`.* FROM `userdetails` WHERE `userdetails`.`user_id` IN (3, 4)
-
Called to Cache
被称为缓存
CACHE (0.0ms) SELECT `userdetails`.* FROM `userdetails` WHERE `userdetails`.`user_id` = 3 LIMIT 1
-
Unknown
未知
(0.1ms) SELECT COUNT(*) FROM `votes` WHERE `votes`.`voter_id` = 3 AND `votes`.`voter_type` = 'User' AND `votes`.`votable_id` = 5690 AND `votes`.`votable_type` = 'Post'
There is no LOAD or CACHE word indicating the store in type 3
没有LOAD或CACHE字表示存储在类型3中
How do I know where this query was performed?
我如何知道此查询的执行位置?
1 个解决方案
#1
1
I think it's because you're doing a count. CACHE
would have been written anyway if it was sent to the cache, my guess is that it was performed on the DB.
我想这是因为你在做点算。如果将CACHE发送到缓存,则无论如何都会编写CACHE,我的猜测是它是在DB上执行的。
To verify this, you could try to execute the query several times in a row, the subsequent calls should be marked as CACHE
要验证这一点,您可以尝试连续多次执行查询,后续调用应标记为CACHE
#1
1
I think it's because you're doing a count. CACHE
would have been written anyway if it was sent to the cache, my guess is that it was performed on the DB.
我想这是因为你在做点算。如果将CACHE发送到缓存,则无论如何都会编写CACHE,我的猜测是它是在DB上执行的。
To verify this, you could try to execute the query several times in a row, the subsequent calls should be marked as CACHE
要验证这一点,您可以尝试连续多次执行查询,后续调用应标记为CACHE