New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Relation#exists?
queries with query cache
#29454
Fix Relation#exists?
queries with query cache
#29454
Conversation
If a connection adapter overrides `select_*` methods, query caching will doesn't work. This patch changes `select_value` to `select_one` in `Relation#exists?` to ensure query caching. Fixes rails#29449.
I wonder whether other callers are expecting |
👍 for the second change. Does it not have an overhead? |
|
It seems like this can be cleanly and safely backported to |
Thank you @kamipo for jumping on this. I for one really appreciate all the hard work all of you put into these performance updates. I've tried following along on several of the PRs (like @matthewd's awesome connection pool updates), but it is definitely a different league. One thing I was going to check was to see if other typical Rails queries are relying on As for:
People can currently opt out of the query cache right now yeah?
My vote would be that the programmer should be explicit by wrapping their queries in There could also exist other scenarios that I'm not aware of, but that feels appropriate with the bits that I do. |
Fix `Relation#exists?` queries with query cache
Fix `Relation#exists?` queries with query cache
…_cache" This reverts commit 6bb76f1.
`test_middleware_caches` is sometimes failed since rails#29454. The failure is due to schema statements are affected by query caching. Bypassing query caching for schema statements to avoid the issue.
`test_middleware_caches` is sometimes failed since rails#29454. The failure is due to schema statements are affected by query caching. Bypassing query caching for schema statements to avoid the issue.
If a connection adapter overrides
select_*
methods, query caching willdoesn't work. This patch changes
select_value
toselect_one
inRelation#exists?
to ensure query caching.Fixes #29449.