Minimize Database round trips

I think this would create a big improvement in performance for Rails.

The idea is that a single page load may load a lot of different resources, thus having multiple database round trips, which is very costly.

If we can provide an api to allow developer to batch those SQL queries and hold on not sending to DB, then send them together we you explicitly call done or something like that, then you can build another round of batches relying on the data you got from the first batch and so on. In that way, I would predict most of the pages data, no matter how complicated, could be fetched using less than 3 database round trips.

There’s a gem https://github.com/leoasis/activerecord-futures implemented it but it’s no longer maintained and I think it’s very useful for Rails project anyways.

What do you guys think? I am pretty new to Rails implementation ( only used Rails for a year), so I need some help to get this done.