Statistiky se automaticky neaktualizují, dokud nejsou statistiky znovu potřeba. aka, TRUNCATE to nedělá. Takže "Ne".
Původní odpověď byla "Ano", protože to není automatické jako součást TRUNCATE. Záleží, jak čtete otázku :-)
Pamatujte, že statistiky se aktualizují automaticky, když to dotaz potřebuje (např. počet změn řádku). Z "Statistika indexu " v BOL
Jeden způsob ověření pomocí STATS_DATE ...
SELECT
name AS index_name,
STATS_DATE(object_id, index_id)
FROM
sys.indexes
WHERE
object_id = OBJECT_ID('MyTruncatedTable')
Upravit :Chtěl jsem se ujistit :-)
Uvidíte, že statistiky se aktualizují pouze příkazy SELECT, nikoli příkazy INSERT, DELETE nebo 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')