Database Reference
In-Depth Information
To understand the effect of small data modifications on a statistics update, create a session using Extended
Events. In the session, add the event auto_stats , which captures statistics update and create events, and add
sql_batch_completed . Here's the script to create an Extended Events session:
CREATE EVENT SESSION [Statistics] ON SERVER
ADD EVENT sqlserver.auto_stats(
ACTION(sqlserver.sql_text)),
ADD EVENT sqlserver.missing_column_statistics(SET collect_column_list=(1)
ACTION(sqlserver.sql_text)
WHERE ([sqlserver].[database_name]=N'AdventureWorks2012'))
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30
SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=ON,STARTUP_STATE=OFF)
GO
Add only one row to the table.
INSERT INTO dbo.Test1
(C1)
VALUES (2);
When you reexecute the preceding SELECT statement, you get the same execution plan as shown in Figure 12-1 .
Figure 12-2 shows the events generated by the SELECT query.
Figure 12-2. Session output on the addition of a small number of rows
 
Search WWH ::




Custom Search