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); doing them directly in sql is a big NO-NO, since I have instructions not do it, I'm contemplating If I should do them on active records and then update, but I will have to update a lot of them.
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?