如何查看表、索引占用的空间?

dlkfth 2003-05-23 01:11:07
如何查看表、索引占用的空间?
...全文
328 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
leimin 2003-05-23
  • 打赏
  • 举报
回复
you can use below to check all database space used.

sp_msforeachtable "sp_spaceused '?'; "
enhydraboy 2003-05-23
  • 打赏
  • 举报
回复
哈,sp_spaceused显示的信息中包括了index_size。
enhydraboy 2003-05-23
  • 打赏
  • 举报
回复
如果是索引,是不是应该
DBCC UPDATEUSAGE(northwind) --对表和聚集索引中 sysindexes 表的 rows、used、reserved 和 dpages 列进行更正
go

use northwind

select name,indid,dpages,reserved,used from sysindexes

go

如果indid<>255,就看dbpages,如果indid=255,就看reserved,used。
SQL Server每页的大小好像是8K。
enhydraboy 2003-05-23
  • 打赏
  • 举报
回复
表的使用空间
use northwind
go

sp_spaceused 'orders'
go
ldcr520 2003-05-23
  • 打赏
  • 举报
回复
查看表:
sp_spaceused table_name.

27,579

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧