1.) Querying + grouping together ~50,000 rows in real-time, all the time
2.) Querying + grouping together ~50,000 rows in real-time once, then caching the output in a DB column
3.) Querying + grouping together ~50,000 rows in real-time once, then caching the output in a text file
Obviously, 1 will be the slowest, but will the performance increases of 2 or 3 justify the work needed to build a caching system? And which of the final 2 would be optimal?