Notice (8): file_put_contents(): Write of 270 bytes failed with errno=28 No space left on device [CORE/src/Log/Engine/FileLog.php, line 140]

Notice: file_put_contents() [function.file-put-contents]: Write of 1108 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 284 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 2559 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): unserialize() [<a href='https://secure.php.net/function.unserialize'>function.unserialize</a>]: Error at offset 8170 of 8181 bytes [APP/Controller/NewsController.php, line 5571]

Notice: file_put_contents() [function.file-put-contents]: Write of 2758 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Undefined array key "nsort" [APP/Controller/NewsController.php, line 3613]

Notice: file_put_contents() [function.file-put-contents]: Write of 2074 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Trying to access array offset on value of type null [APP/Controller/NewsController.php, line 3613]

Notice: file_put_contents() [function.file-put-contents]: Write of 2098 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Undefined array key "nsort" [APP/Controller/NewsController.php, line 3613]

Notice: file_put_contents() [function.file-put-contents]: Write of 2074 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Trying to access array offset on value of type null [APP/Controller/NewsController.php, line 3613]

Notice: file_put_contents() [function.file-put-contents]: Write of 2098 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): unserialize() [<a href='https://secure.php.net/function.unserialize'>function.unserialize</a>]: Error at offset 36833 of 36853 bytes [APP/Controller/NewsController.php, line 5571]

Notice: file_put_contents() [function.file-put-contents]: Write of 2490 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
SQLServer利用sp_spaceused如何查看表记录存在不准确的情况 - 站长搜索
首页 > 资讯列表 > 编程/数据库 >>

SQLServer利用sp_spaceused如何查看表记录存在不准确的情况

Warning (2): Undefined array key "nsort" [ROOT/plugins/Kuhuang/templates/Websites/view.php, line 430]
Notice: file_put_contents() [function.file-put-contents]: Write of 2422 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Trying to access array offset on value of type null [ROOT/plugins/Kuhuang/templates/Websites/view.php, line 430]

Notice: file_put_contents() [function.file-put-contents]: Write of 2446 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
">
Warning (2): Undefined array key "nsort" [ROOT/plugins/Kuhuang/templates/Websites/view.php, line 430]

Notice: file_put_contents() [function.file-put-contents]: Write of 2422 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Trying to access array offset on value of type null [ROOT/plugins/Kuhuang/templates/Websites/view.php, line 430]

Notice: file_put_contents() [function.file-put-contents]: Write of 2446 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
2022-09-23 16:42:51 转载来源: 网络整理/侵权必删

前言在之前写过一篇博客"关系数据库如何快速查询表的记录数",里面介绍了使用sp_spaceused查看表的记录数是否正确的问题,具体如下:关于问题3:有多个索引的表,是否记录数会存在不一致的情况?   答案:个人测试以及统计来看,暂时发现多个索引的情况下,sys.partitions中的rows记录数都是一致的。暂时没有发现不一致的情况,当然也不排除有特殊情况

前言

在之前写过一篇博客"关系数据库如何快速查询表的记录数",里面介绍了使用sp_spaceused看表的记录数是否正确的问题,具体如下:

关于问题3:有多个索引的表,是否记录数会存在不一致的情况?
 
   答案:个人测试以及统计来看,暂时发现多个索引的情况下,sys.partitions中的rows记录数都是一致的。暂时没有发现不一致的情况,当然也不排除有特殊情况。
 
关于问题5: 分区表的情况又是怎么样?
 
   答案:分区表和普通表没有任何区别。
 
关于问题6:对象目录视图sys.partitions与sp_spaceused获取的表记录函数是否准确?
 
   答案:对象目录视图sys.partitions与sp_spaceused获取的表记录数是准确的。

但是,今天遇到一个问题,直接推翻了之前博客里面下的这个结论。如下截图所示,发现不同的索引的记录数不一样。所以问题3,应该这样回答:

    大部分情况下,sys.partitions中的rows记录数都是一致的。但是也有发现不同索引的rows不一致的情况

另外,也发现sp_spaceused 中返回的记录数跟SELECT COUNT(*) 不一致。但是从碎片,统计信息等各个方面都分析了一下,实在没有搞清楚什么原因会导致这种情况出现。在数据库找了一下,发现这样的情况非常少,但是确实也是存在的。特此记录一下

sp_spaceused 'dbo.spcecial_table'; SELECT partition_id, object_id, index_id,row_count FROM sys.dm_db_partition_stats WHERE object_id= OBJECT_ID('dbo.spcecial_table')    SELECT object_id, index_id, rows FROM sys.partitionsWHERE object_id= OBJECT_ID('dbo.spcecial_table')   SELECT object_id, index_id, rows FROM sys.partitionsWHERE object_id= OBJECT_ID('spcecial_table');  SELECT COUNT(*) FROM spcecial_table

如下截图所示,sp_spaceused 获取的记录数为8718528, 但是SELECT COUNT(*)为8735537。

 

关于问题6:对象目录视图sys.partitionssp_spaceused获取的表记录函数是否准确?

  答案:对象目录视图sys.partitionssp_spaceused获取的表记录数是准确的。

正确答案:对象目录视图sys.partitionssp_spaceused获取的表记录数是大部分是准确的。但是也存在记录数不准确的情况。只是目前不清楚在什么场景下,会出现不准确的情况。

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对脚本之家的支持。

标签: SQLServer 利用 sp spaceused 如何 看表 记录 存在 不准确


声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!

站长搜索

http://www.adminso.com

Copyright @ 2007~2025 All Rights Reserved.

Powered By 站长搜索

打开手机扫描上面的二维码打开手机版


使用手机软件扫描微信二维码

关注我们可获取更多热点资讯

站长搜索目录系统技术支持