Hi abbas, Thank you so much. I've got this query from my development team asking to improve its performance. Now I got pretty much clear idea of it. And it will be the final extent to which we can tune the performance right? If there is still a way give me some tips to enhance the query performance. But kudos for your "floor" function. After a long struggle with the indexes, joins and the hints I came to know that there is also a way to tune the query performance by rewriting the query. Thanks in advance. Regards, Pavan -- Sent from: http://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html