Hacker News new | past | comments | ask | show | jobs | submit login

> If your database queries are a mess,

This has been the cause of basically all of the slowness in Rails projects I've worked on, at least. I've seen queries taking tens of thousands of times longer than they should.

I don't think I've ever seen a Rails codebase that didn't have speed problems, but every single time it's been because DB access is being done very inefficiently. I've yet to see one actually bound by the computational speed of Ruby (I'm sure it happens, though) and it's considered way on the slow end of popular languages.

The problem's always 1) Doing shit in Ruby that the DB can do a thousand times faster (joins[!], calculating things based on a huge number of rows, mashing together pieces of data, et c.) with a better query, or 2) firing tons of identical-but-for-some-values queries in a loop(!?)

[EDIT] Actually, just as I hit post, it occurred to me that 2 is really just a flavor of 1.




The "query in a loop" thing happens a lot. This is the danger of hiding databases behind magical frameworks and ORMs. Some developers don't understand the basic idea that a single database query with execution time and the network roundtrip can destroy your app performance. They literally treat all ORM code as "free".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: