首页 > 代码库 > 查询sybase DB中占用空间最多的前20张表

查询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