diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2014-11-25 03:55:15 -0800 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2014-11-25 03:55:15 -0800 |
commit | 56f2b70db1210f63e972a8755551cc6eb95dc497 (patch) | |
tree | 68191d7783db0f1245997f2dd321aaf6d0ca6dd2 /guides/source | |
parent | f2a0567b314de7468d5fa16ccb0e11b41d9f4297 (diff) | |
download | rails-56f2b70db1210f63e972a8755551cc6eb95dc497.tar.gz rails-56f2b70db1210f63e972a8755551cc6eb95dc497.tar.bz2 rails-56f2b70db1210f63e972a8755551cc6eb95dc497.zip |
Simplify section on adequate record [ci skip]
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/4_2_release_notes.md | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/guides/source/4_2_release_notes.md b/guides/source/4_2_release_notes.md index 69562e21da..ca61f9968f 100644 --- a/guides/source/4_2_release_notes.md +++ b/guides/source/4_2_release_notes.md @@ -54,26 +54,26 @@ then deserialized again at run time. ### Adequate Record -Adequate Record is a set of refactorings that make Active Record `find` and -`find_by` methods and some association queries up to 2x faster. +Adequate Record is a set of performance improvements in Active Record that makes +common `find` and `find_by` calls and some association queries up to 2x faster. -It works by caching SQL query patterns while executing the Active Record calls. -The cache helps skip parts of the computation involved in the transformation of -the calls into SQL queries. More details in [Aaron Patterson's -post](http://tenderlovemaking.com/2014/02/19/adequaterecord-pro-like-activerecord.html). +It works by caching common SQL queries as prepared statements and reusing them +on similar calls, skipping most of the query-generation work on subsequent +calls. For more details, please refer to [Aaron Patterson's blog post](http://tenderlovemaking.com/2014/02/19/adequaterecord-pro-like-activerecord.html). -Nothing special has to be done to activate this feature. Most `find` and -`find_by` calls and association queries will use it automatically. Examples: +Active Record will automatically take advantage of this feature on the supported +operations without any user involvement and code changes. Here are some examples +of the supported operations: ```ruby -Post.find 1 # caches query pattern -Post.find 2 # uses the cached pattern +Post.find 1 # First call will generate and cache the prepared statement +Post.find 2 # Second call will reuse the cached statement -Post.find_by_title 'first post' # caches query pattern -Post.find_by_title 'second post' # uses the cached pattern +Post.find_by_title 'first post' +Post.find_by_title 'second post' -post.comments # caches query pattern -post.comments(true) # uses cached pattern +post.comments +post.comments(true) ``` The caching is not used in the following scenarios: |