Jan 21 2024 06:40 AM
hi,
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
BEGIN
INSERT INTO testdel VALUES(1)
SET @count = @count + 1;
END;
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