-
Notifications
You must be signed in to change notification settings - Fork 106
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
Detect N+1 Queries #66
Comments
You can use For active record, I think you can use something like the following to raise for unbatched queries def assert_no_unbatched_queries
callback = lambda do |name, start, finish, message_id, values|
raise "unbatched query: #{values[:sql]}" unless GraphQL::Batch::Executor.current.loading
end
ActiveSupport::Notifications.subscribed('sql.active_record', callback) do
yield
end
end which allow you to write tests for unbatched queries. You would need something similar to prevent N+1 queries against other datastores (e.g. memcached or redis). Let me know if that works for you. This repo should probably at least have an example and mention of how to do something like this in the README.
You tell me. I don't have any experience with it. |
@dylanahsmith Bullet gem seams not picking GraphQl N+1queries. |
@eshaiju I have used
|
@eshaiju Is there any update on this? |
Is there any tool like bullet gem to detect N+1 queries in GraphQL resolvers. Does Bullet gem will detect it?
The text was updated successfully, but these errors were encountered: