Hello Devz,
Today I had an issue with the performance of a SQL stored procedure. This procedure was supposed to delete a few millions rows in a table. But it was quite slow… So after optimizing the query, I looked at the database itself.
Having an indexed primary key is important but the level of fragmentation of the index is something important as well.
If you righ click on your index, and check the properties, then select Fragmentation, you can see the level of fragmentation of this index:
As you can see here the level of fragmentation is very important. All you have to do in that case it to Rebuild the index:
And now the performance will be way better…
Happy coding! 🙂