samedi 20 décembre 2014

SQL server Why "delete" statement do not increase the UnUsed Space in a table ?


USE AdventureWorks2012; GO IF OBJECT_ID ('dbo.CleanTableTest', 'U') IS NOT NULL DROP TABLE dbo.CleanTableTest; GO CREATE TABLE dbo.CleanTableTest (FileName nvarchar(4000), DocumentSummary nvarchar(max), Document varbinary(max) ); GO -- Populate the table with data from the Production.Document table. INSERT INTO dbo.CleanTableTest SELECT REPLICATE(FileName, 1000), DocumentSummary, Document FROM Production.Document; GO


exec sp_spaceused CleanTableTest go


name rows reserved data index_size unused




CleanTableTest 13 456 KB 440 KB 8 KB 8 KB


delete dbo.CleanTableTest go


exec sp_spaceused CleanTableTest go


name rows reserved data index_size unused




CleanTableTest 0 88 KB 80 KB 8 KB 0 KB


the answer is ? whay after the delete process of all rows in table the unused space have not changed . it stay 0 KB .


10X





Aucun commentaire:

Enregistrer un commentaire