I used the built-in performance tuning tool and built indexes for my database. Since then I changed some of the queries from “select top 10…” to “select top 50”.
My question is do I need to rebuild my SQL server database indexes?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t need to rebuild your indexes if all you’ve changed is top 10 for top 50. The queries are exactly equal regarding execution plan (and thus will benefit from existing indexes), the only difference is that you are retrieving some extra rows from the resultset.
If you are noticing a big performance drop after that change, the problem must lie elsewhere. For example, I’ve seen the need to rebuild a clustered index for performance reasons after adding data in an order different to the natural order of the index. But this is because of the new data, not because a top 10 changed to top 50.
EDIT: Sam Saffron comments that execution plans can change between top 10 and top 50 queries, to make sure this isn’t happening to you check both execution plans and see if they vary.