I'm really lacking some knowledge regarding efficiency/performance when working with massive amount of data.
I need to do some calculations on different models and then updating them. I was thinking:
Step I. Get the data from each table in hashes (hash_table_1, hash_table_2 etc) "plucking" the active record relations and then map it in a hash
Step II. Do calculations and change the values in the hashes (iterate over hashes, searching ids in hashes)
Step III. Updating data with Table_1.update(hash_table_1), Table_2.update(hash_table_2) etc. OR use raw SQL to update
Should I be using ActiveRecord::Relations instead of hashes? Are they more memory efficient?
Aucun commentaire:
Enregistrer un commentaire