众所周知,DMV 不保存有关页数和行数的准确信息。但是,当您更新统计数据时,我不明白为什么他们不会。
我正在开发一个监控工具,想知道每个索引和数据的磁盘大小等。最终我想找到合适的填充因子,以及其他一些东西。
The space used by my function and the old sp_spaceused differs a little bit on the space usage, but not on record count.
Can you see if there is anything missing in my select?
this is the sp_spaceused (then I convert the numbers in MB):
sp_spaceused 'tblBOrderRelationship'
go
select 318008/1024.00 AS reserved,
140208/1024.00 AS data,
177048/1024.00 AS index_size,
752/1024.00 AS unused
Run Code Online (Sandbox Code Playgroud)

But when I run my select, code below\picture below, I get slightly different figures.
SET TRANSACTION …Run Code Online (Sandbox Code Playgroud)