1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/lib/active_record
Sean Griffin be9b68038e Introduce ActiveRecord::Base#accessed_fields
This method can be used to see all of the fields on a model which have
been read. This can be useful during development mode to quickly find
out which fields need to be selected. For performance critical pages, if
you are not using all of the fields of a database, an easy performance
win is only selecting the fields which you need. By calling this method
at the end of a controller action, it's easy to determine which fields
need to be selected.

While writing this, I also noticed a place for an easy performance win
internally which I had been wanting to introduce. You cannot mutate a
field which you have not read. Therefore, we can skip the calculation of
in place changes if we have never read from the field. This can
significantly speed up methods like `#changed?` if any of the fields
have an expensive mutable type (like `serialize`)

```
Calculating -------------------------------------
 #changed? with serialized column (before)
                       391.000  i/100ms
 #changed? with serialized column (after)
                         1.514k i/100ms
-------------------------------------------------
 #changed? with serialized column (before)
                          4.243k (± 3.7%) i/s -     21.505k
 #changed? with serialized column (after)
                         16.789k (± 3.2%) i/s -     84.784k
```
2015-01-20 14:42:15 -07:00
..
associations Remove unneeded requires 2015-01-04 12:11:03 -03:00
attribute_methods Don't calculate in-place changes on attribute assignment 2015-01-18 13:43:31 -07:00
attribute_set
coders
connection_adapters TransactionManager should call rollback records 2015-01-20 12:37:57 -05:00
fixture_set
locale
locking Go through normal where logic in destroy with locking 2015-01-14 15:25:15 -07:00
migration
railties
relation Fix bind value copying from subqueried relations 2015-01-19 15:19:43 -07:00
scoping
serializers
tasks
type Merge pull request #18543 from henrik/integer_limit_or_default 2015-01-15 22:56:43 +01:00
type_caster Extract an explicit type caster class 2014-12-29 11:07:56 -07:00
validations Don't rely on the column for type information in uniquness validations 2015-01-01 09:44:37 -07:00
aggregations.rb
association_relation.rb
associations.rb Document has_many :extend option 2015-01-08 12:20:37 -06:00
attribute.rb Introduce ActiveRecord::Base#accessed_fields 2015-01-20 14:42:15 -07:00
attribute_assignment.rb
attribute_decorators.rb
attribute_methods.rb Introduce ActiveRecord::Base#accessed_fields 2015-01-20 14:42:15 -07:00
attribute_set.rb Introduce ActiveRecord::Base#accessed_fields 2015-01-20 14:42:15 -07:00
attributes.rb Don't attempt to save dirty attributes which are not persistable 2015-01-10 12:07:46 -07:00
autosave_association.rb Fix potenital stack level too deep with autosave or validation 2015-01-04 23:44:51 +01:00
base.rb Add has_secure_token to Active Record 2015-01-04 11:31:37 -05:00
callbacks.rb Deprecate false as the way to halt AR callbacks 2015-01-02 15:31:56 -08:00
connection_handling.rb
core.rb Remove support for the protected attributes gem 2015-01-09 22:42:29 -02:00
counter_cache.rb
dynamic_matchers.rb Remove support to activerecord-deprecated_finders 2015-01-02 12:06:24 -03:00
enum.rb
errors.rb
explain.rb
explain_registry.rb
explain_subscriber.rb
fixtures.rb Fix lookup of fixtures with non-string label 2015-01-06 17:15:39 +05:30
gem_version.rb
inheritance.rb Remove deprecated symbolized_base_class and symbolized_sti_name 2015-01-04 11:58:44 -03:00
integration.rb
log_subscriber.rb Stop special casing null binary data in logging 2015-01-10 12:26:51 -07:00
migration.rb Do not check only for the Rails constant 2015-01-02 00:45:09 -03:00
model_schema.rb Extract an explicit type caster class 2014-12-29 11:07:56 -07:00
nested_attributes.rb A quick pass through NestedAttributes' doc [ci skip] 2015-01-02 22:05:52 +01:00
no_touching.rb
null_relation.rb Remove support to activerecord-deprecated_finders 2015-01-02 12:06:24 -03:00
persistence.rb Run SQL only if attribute changed for update_attribute method 2015-01-18 20:00:57 +05:30
query_cache.rb
querying.rb Fix doc formatting for count_by_sql 2015-01-01 09:32:18 -08:00
railtie.rb
readonly_attributes.rb
reflection.rb remove deprecated support to preload instance-dependent associaitons. 2015-01-05 11:44:14 +01:00
relation.rb Don't mutate bind values in Relation 2015-01-19 13:23:28 -07:00
result.rb
runtime_registry.rb
sanitization.rb Stop passing a column to quote when finding by AR models 2015-01-10 15:45:46 -07:00
schema.rb
schema_dumper.rb
schema_migration.rb
scoping.rb
secure_token.rb Fix Typo SecureToken for schema sample [ci skip] 2015-01-15 16:06:01 +01:00
serialization.rb
statement_cache.rb Stop passing a column to quote when executing from a statement cache 2015-01-10 15:45:46 -07:00
store.rb
table_metadata.rb Move create_binds over to the PredicateBuilder 2015-01-19 15:19:43 -07:00
timestamp.rb
transactions.rb Use keyword args on committed! and rolledback! 2015-01-09 15:35:51 -05:00
translation.rb
type.rb
type_caster.rb Extract an explicit type caster class 2014-12-29 11:07:56 -07:00
validations.rb AR specific length validator to respect marked_for_destruction. 2014-12-30 10:25:58 +01:00
version.rb