some space appears to be reclaimed after delete operation

Copper Contributor


I'm using SQL SERVER 2022. My understanding is that space does not get reclaimed after a delete operation. However, my test results showed that some data appears to get reclaimed. Here's my test case. Could someone help me understand the results?

create table testdel
(col1 int)

DECLARE @count INT;  
SET @count = 1;   
WHILE @count <= 10000
   INSERT INTO testdel VALUES(1)  
   SET @count = @count + 1;  

sp_spaceused 'testdel'
--results show 200KB reserved space and 136KB of data

delete testdel

sp_spaceused 'testdel'
--results show 136KB reserved space and 80KB of data
0 Replies