diff options
author | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-03-09 14:54:26 +0000 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-03-13 18:59:36 +0000 |
commit | 4dc99f326abcd73ba3564e8294c823d0a07a2f44 (patch) | |
tree | e9c72dfdcb95a7cd1fbe087dfcb0a700af0083e1 /doc/development/merge_request_performance_guidelines.md | |
parent | 1dc2e185b8dfb7dfdccabe28998b30265f4ef39d (diff) | |
download | gitlab-ce-4dc99f326abcd73ba3564e8294c823d0a07a2f44.tar.gz |
Adds docs for QueryRecorder tests28492-add-dev-documentation-for-using-the-queryrecorder-in-specs
Diffstat (limited to 'doc/development/merge_request_performance_guidelines.md')
-rw-r--r-- | doc/development/merge_request_performance_guidelines.md | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/doc/development/merge_request_performance_guidelines.md b/doc/development/merge_request_performance_guidelines.md index 8232a0a113c..2b4126b43ef 100644 --- a/doc/development/merge_request_performance_guidelines.md +++ b/doc/development/merge_request_performance_guidelines.md @@ -68,7 +68,7 @@ end This will end up running one query for every object to update. This code can easily overload a database given enough rows to update or many instances of this code running in parallel. This particular problem is known as the -["N+1 query problem"](http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations). +["N+1 query problem"](http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations). You can write a test with [QueryRecoder](query_recorder.md) to detect this and prevent regressions. In this particular case the workaround is fairly easy: @@ -117,6 +117,8 @@ Post.all.includes(:author).each do |post| end ``` +Also consider using [QueryRecoder tests](query_recorder.md) to prevent a regression when eager loading. + ## Memory Usage **Summary:** merge requests **must not** increase memory usage unless absolutely |