I have lots of data in database and I wanna make a statistics from them. Lots of data = thousands rows in table, and I wanna get the daily, weekly, monthly (for every month) stats... just detailed statistics.
The problem is, that the getting these data takes a time (and not little).
So, I think what would be the fastest, clearest and just most effective way to get it...
My first idea - when the user come to my app, in the ApplicationController
method I'll fetch from DB stats, save the objects I got into the session's variable and then I will use these variables as a source. Then when I would need somewhere in the app print out the stats, I just use this loaded data.
The question is: is this a good idea? Or, exist any better way?
Instead of storing DB stats in session variable. You can store in memcached
Rails has excellent built-in support for caching