查询sybase DB中占用空间最多的前20张表

按照数据行数查询

Select top 20   name,    row_count(db_id(), id) from   sysobjects order by   row_count(db_id(),id) desc

 

按照分配的空间查询

Select top 20    name,   reserved_pages(db_id(),id)/(1024.0 / (@@maxpagesize/1024.0) ) as "Allocated MB" from    sysobjects order by   reserved_pages(db_id(),id) desc

 

按照已使用空间查询

Select top 20    name,    used_pages(db_id(),id)/(1024.0 / (@@maxpagesize/1024.0) ) as "Used MB" from    sysobjects order by    used_pages(db_id(),id) desc

 

posted @ 2014-07-15 14:39  Fintech技术汇  阅读(1280)  评论(0编辑  收藏  举报