performance - Efficiency of uniqueness validation in Active Record Rails -
which more efficient while creating records unique values column in rails placing uniqueness validation vs finding if record exists same value , create based on existence.
which more efficient in terms of coding , performance.
a database uniqueness constraint give highest performance.
at application level, whether using validates_uniqueness_of
or manually finding if record exists, performance same. in fact, how implemented in rails: https://github.com/rails/rails/blob/0d73d6e7b6dd1900f105397460b777ef6c03d3b6/activerecord/lib/active_record/validations/uniqueness.rb#l33
Comments
Post a Comment