I agree with @h_kataria, but just wanted to add one more thought. We have some quite complex queries on our project and cannot optimize them further. Therefore, for the ones that take a long time, we use an in-memory cache. A cache can be based on TTL if that is acceptable, or you can invalidate it ...