Why not define a limit of rows to return?, for example 1000. If the user wants to find more specific information should use filters. That will avoid a large consume of memory due storing 25k rows on cache and the requests to database will take less time to process.