日期:2014-05-18  浏览次数:20409 次

用sp_spaceused检测表的空间误差
我从ORACLE上导了张很大的表下来,记录数是12393377;
在SQL   SERVER中核对数据,
一开始用的是:sp_spaceused   my_table   检测到ROWS:12393000
而用select   count(*)   from   my_table   显示为:12393377

这是为什么呢?会有这么大误差,我还以为导数出错了,
不明白,就是因为用select   来检测速度慢,才用sp_spaceused的,
怎么办呢?

------解决方案--------------------
sp_spaceused my_table 检测到ROWS是一个估计值,select count(*)是准确值
------解决方案--------------------
select rows from sysindexes
where indid <2 and id=object_id( 'my_table ')