3 ms·
The main danger with mixing SELECT * and ORMs when you only need some particular columns is the performance hit. Not just on the database itself. You also need
by jacques_chester 13y ago
The main danger with mixing SELECT * and ORMs when you only need some particular columns is the performance hit.
Not just on the database itself. You also need to ship surplus data to your application and then instantiate objects with surplus fields. All of this takes bandwidth, RAM and time.
I also once saw someone write idiomatic ruby that performed a sum over an ActiveRecord .each. In dev, nobody noticed. In production it pulled a 9 million row table across, iterated over 9 million ruby objects, all to sum up a few hundred kb of actual data that the database could do in a few hundred ms.
The problem is hoping that ORMs will make those icky databases go away. They don't. They can't.