2

I remember reading once that it is possible to force SQL Server to assume a table is a certain size, or perhaps even override a statistics histogram, when compiling a query. Can someone explain how to do that, if it's possible?

To be clear: the purpose of this is to do what-if scenario analysis, outside of production, when writing queries. I am not talking about modifying the query itself or using query hints. (Examples of modifying the query and using query hints can be found in the answers to this question.)

1

1 Answer 1

2

You can use the UPDATE STATISTICS WITH ROWCOUNT and PAGECOUNT option

See here some examples : https://www.mssqltips.com/sqlservertip/2870/using-with-rowcount-and-pagecount-option-of-sql-server-update-statistics/ or https://sqlsunday.com/2016/02/27/update-statistics-with-rowcount/

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.