We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
" If we have 1000 builds, we'll need to connect to the database 1001 times. Remote database connections are not free, and each connection introduces a heavy performance penalty."
That's not true. Rails uses a connection pool, and in the same process all queries will use the same connection. The performance penalty is coming from doing multiple queries instead of one.
You are correct, saying 'connecting' is not the right choice of words.
Is this the case even with latest builds of Rails 5? I think I read/heard a specific Rails community person say the're trying to do away with N+1. Or I am guessing .includes(:branches) IS the solution that they've baked in.
Good question. We'll need to look into the latest Rails 5.x release.
But my best guess is that this is not possible to resolve completely. Using includes every time has the opposite risk of loading too much data.
True loading too much data will end up more RAM consumption.
Plus how do they do a eager loading in first query? How do they know that the data going to end up in a N+1 situation in later code?
On this very same topic, I also recommend: https://goiabada.blog/to-jo...