Query optimization to reduce query time and memory usage

Hi @anand