The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

jfauden (1) [Avatar] Offline

Whenever I run this queruy I will get SQL for about two or three UPDATE STATISTICS staements followed by:

Msg 50000, Level 16, State 1, Line 57
No indexes found with @RowsToBenchMark > 500000
ian.stirk (27) [Avatar] Offline
Re: Listing 10.6 Intelligent update statistics – time based version

Thanks for your question.

In essence, you received this error message because you do not have a relevant index that contains at least 500,000 rows.

The purpose of the script is to reduce the time it takes to intelligently sample the statistics on indexes with lots of rows.

To do this, it first determines how long it takes to update a given number of rows. If there are not many rows in the indexes, it cannot accurately determine how long the statistics will take to update, and so cannot calculate this benchmark. This results in the error message you reported being output.

This routine is really only for indexes with many rows (several million), since taking statistics on smaller indexes should typically complete in a timely manner. I should make this more explicit in the text.

I hope this helps.