I can't find exact answer on my question. When i right click on any database in SSMS, i see "Space available parameter". Is this free space in mdf file only or it include transaction log file too (free space in mdf + ldf files together)? Thanks
I asked because … I have a table (size about 450GB with 5 millions rows) with LOB data.
Application support delivered this script to delete some rows (should delete about 300K rows).
declare @cnt int;
declare @cnt_total int = 0;
set nocount off
while 1 = 1
begin
delete top(5000) -- PARAM BATCH_SIZE
from fw.fw_o_clob
where DT_TEC_CREATED < '2019-01-01T00:00:00.0000000'
AND ID_CLOB <> -1
;
set @cnt = @@ROWCOUNT;
set @cnt_total += @cnt;
if @cnt = 0
break;
end;
print concat('Total ', @cnt_total, ' rows deleted.');
go
But when we run this, "Size DB" started growing (info from properties) – this is OK, because transaction log started growing but what is interesting "Space available" was getting smaller and smaller so we canceled it. Can someone explain me why? Thanks
Best Answer
From looking at a Profiler trace of the SSMS dialog opening the queries are essentially:
Size:
and
Space Available:
So Size includes the log file, but Space Available does not. It's only the unallocated space in database files.