3 ms·
<Screams in Active Record> The default ORM in Ruby… not great at scale. I had a large client with moderate traffic, they were slow because they were absolutel
by more_corn 4y ago
<Screams in Active Record>
The default ORM in Ruby… not great at scale.
I had a large client with moderate traffic, they were slow because they were absolutely crushing their DB. Now granted it was not JUST ruby, but ruby was a big part of it. We profiled their slow queries and found stuff no human would think is sane.
Active record is great for the developer and terrible for database optimization. Which is fine until you try to scale. Then you fall over on your face.
Ruby is slow because it constructs retarded database queries that no human would ever use. Think ten lines long and multiple joins.
- JohnBooty 4y agoThe question is: is ActiveRecord worse at query generation than other ORMs? My answer is no, it is not. In my experience ORMs are all pretty much equal at this. (However, I would love to be wrong!) I don't know of any ORM that intelligently analyzes your database and comes up with highly optimized queries. I'm not sure such a thing is possible. The database's own query analyzer can optimize query execution because it has intimate knowledge of the database's own data structures, indexes, data cardinality, etc. I accept ORMs as a necessary evil for most work. However, I enjoy ActiveRecord because unlike some ORMs it makes it fairly easy to simply use raw handwritten SQL when needed.
- slimdave 4y ago