How to tune your Queries with sorted indexes

Creating indexes can sometimes be painful since wrong indexing on tables causes performance bottlenecks. In our project, ordering of some tables take some time that we do not expect.  After researching on performance tuning, we found out that a couple of tables are always queried with order by desc. I created sorted indexes on these tables and got rid of sorting operation. The qeury plan below shows that sorting can be a pain in the ass.Indexing1 

After creating the sorted index where you can find the creation code below ,

create index IX_AverageRating_AlbumId on

the query plan changed, and no sorting operation is needed.


Hiç yorum yok: