Statistik uppdateras inte automatiskt förrän statistiken behövs igen. aka, TRUNCATE gör det inte. Så "Nej".
Det ursprungliga svaret var "Ja" eftersom det inte är automatiskt som en del av TRUNCATE. Det beror på hur du läser frågan :-)
Kom ihåg att statistik uppdateras automatiskt när det behövs av en fråga (t.ex. antal radändringar). Från "Indexstatistik " i BOL
Ett sätt att verifiera med STATS_DATE ...
SELECT
name AS index_name,
STATS_DATE(object_id, index_id)
FROM
sys.indexes
WHERE
object_id = OBJECT_ID('MyTruncatedTable')
Redigera :Jag ville vara säker :-)
Du kommer att se att statistiken bara uppdateras av SELECT-satserna, inte INSERT, DELETE eller TRUNCATE
IF OBJECT_ID('dbo.foo') IS NOT NULL DROP TABLE dbo.foo
CREATE TABLE dbo.foo (
bar int NOT NULL IDENTITY (1, 1) PRIMARY KEY,
thing int NOT NULL
)
CREATE INDEX IX_thing ON dbo.foo (thing)
INSERT dbo.foo (thing) SELECT c1.object_id FROM sys.columns c1, sys.columns c2
SELECT
name AS index_name,
STATS_DATE(object_id, index_id) AS AfterLoad
FROM sys.indexes WHERE object_id = OBJECT_ID('dbo.foo')
SELECT DISTINCT thing FROM dbo.foo ORDER BY thing DESC
SELECT
name AS index_name,
STATS_DATE(object_id, index_id) AS AfterFirstQuery
FROM sys.indexes WHERE object_id = OBJECT_ID('dbo.foo')
DELETE TOP (50000) dbo.foo
SELECT
name AS index_name,
STATS_DATE(object_id, index_id) AS AfterDelete
FROM sys.indexes WHERE object_id = OBJECT_ID('dbo.foo')
SELECT DISTINCT thing FROM dbo.foo ORDER BY thing DESC
SELECT
name AS index_name,
STATS_DATE(object_id, index_id) AS After2ndQuery
FROM sys.indexes WHERE object_id = OBJECT_ID('dbo.foo')
TRUNCATE TABLE dbo.foo
SELECT
name AS index_name,
STATS_DATE(object_id, index_id) AS AfterTruncate
FROM sys.indexes WHERE object_id = OBJECT_ID('dbo.foo')
SELECT DISTINCT thing FROM dbo.foo ORDER BY thing DESC
SELECT
name AS index_name,
STATS_DATE(object_id, index_id) AS After3rdQuery
FROM sys.indexes WHERE object_id = OBJECT_ID('dbo.foo')