Pre-Preparation:
Normal table, temporary table: It has statistical information on the two sessions.
Table variable: There is no statistical information.
--------------------------------------------------------------------------------------------------------------- -----------------------------------
Create a scenario for statistics:
1. When you create an index, statistics are created on the appropriate columns.
2. It is created automatically when SQL Server needs it and does not.
3, create statistics to be created manually.
Scenarios for Updating statistics:
1, the table from no data into a data.
2, for a table less than 500 rows, the first field of statistical information changes more than 500.
3, for tables greater than 500 rows, statistics of the first field change is greater than 500 + (20% times the number of lines) after.
4, rebuild the index.
SQL Server statistics creation and update