gpt4 book ai didi

SQL Anywhere 11 - 表大小

转载 作者:行者123 更新时间:2023-12-04 12:23:41 24 4
gpt4 key购买 nike

我正在尝试使用 SQL Anywhere 11 从数据库中获取每个表的表大小。

我才发现 sp_spaceused已被弃用

对此的任何帮助将不胜感激! :)

最佳答案

系统 View SYSTAB 可能是一个足够好的替代方案。它可以为您提供表中的行数,并且可以为您提供表使用的页数。 (在下面的示例中,我将页面数乘以数据库的页面大小以获得总字节大小。)

SELECT
count, -- number of rows in the table
(table_page_count * DB_PROPERTY('PageSize')) tablesize
-- total size, in bytes
FROM SYSTAB
WHERE table_name = 'mytable'; -- or whatever limitations you want on
-- the scope of the query

希望这可以帮助。

关于SQL Anywhere 11 - 表大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10035463/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com