select top 1 col1
from table1
order by CreatedOn desc
This query takes 6 minutes on SQL Server 2005 to execute.
The table contains about 25,00,000 rows and number of total columns is 36, but as shown above I am just retrieving a single column whose datatype is uniqueidentifier
.
So, please help me out on optimization and do let me know if any more details are required.
Well, let me tell you that I cannot change my table structure or cannot do any changes to table like index, etc. Suggest changes to query only or changes which won't have an impact on table structure.