dbadmin=> SELECT GET_COMPLIANCE_STATUS();
GET_COMPLIANCE_STATUS
---------------------------------------------------------------------------------
Raw Data Size: 4.83TB +/- 0.24TB
License Size : 30.00TB
Utilization : 16%
Audit Time : 2014-05-11 23:59:49.763799+00
Compliance Status : The database is in compliance with respect to raw data size.
License End Date: 10/30/2014
Days Remaining: 171.18
如果有权限,可以直接查询license_audits表:
SELECT /*+ label(license_utilization)*/
audit_start_timestamp,
database_size_bytes / ( 1024^3 ) AS database_size_gb,
license_size_bytes / ( 1024^3 ) AS license_size_gb,
usage_percent
FROM v_catalog.license_audits
ORDER BY audit_start_timestamp DESC
LIMIT 30;
SELECT /*+ label(estimated_raw_size)*/
pj.anchor_table_schema,
pj.used_compressed_gb,
pj.used_compressed_gb * la.ratio AS raw_estimate_gb
FROM (SELECT ps.anchor_table_schema,
SUM(used_bytes) / ( 1024^3 ) AS used_compressed_gb
FROM v_catalog.projections p
JOIN v_monitor.projection_storage ps
ON ps.projection_id = p.projection_id
WHERE p.is_super_projection = 't'
GROUP BY ps.anchor_table_schema) pj
CROSS JOIN (SELECT (SELECT database_size_bytes
FROM v_catalog.license_audits
ORDER BY audit_start_timestamp DESC
LIMIT 1) / (SELECT SUM(used_bytes)
FROM V_MONITOR.projection_storage) AS ratio) la
ORDER BY pj.used_compressed_gb DESC;
SELECT /*+ label(compressed_table_size)*/
anchor_table_schema,
anchor_table_name,
SUM(used_bytes) / ( 1024^3 ) AS used_compressed_gb
FROM v_monitor.projection_storage
GROUP BY anchor_table_schema,
anchor_table_name
ORDER BY SUM(used_bytes) DESC;
SELECT /*+ label(estimated_raw_size)*/
pj.anchor_table_schema,
pj.used_compressed_gb,
pj.used_compressed_gb * la.ratio AS raw_estimate_gb
FROM (SELECT ps.anchor_table_schema,
SUM(used_bytes) / ( 1024^3 ) AS used_compressed_gb
FROM v_catalog.projections p
JOIN v_monitor.projection_storage ps
ON ps.projection_id = p.projection_id
WHERE p.is_super_projection = 't'
GROUP BY ps.anchor_table_schema) pj
CROSS JOIN (SELECT (SELECT database_size_bytes
FROM v_catalog.license_audits
WHERE audited_data = 'Regular'
ORDER BY audit_start_timestamp DESC
LIMIT 1) /
(SELECT SUM(used_bytes)
FROM V_MONITOR.projection_storage) AS ratio) la
ORDER BY pj.used_compressed_gb DESC;
SELECT anchor_table_schema,
anchor_table_name,
SUM(used_bytes) / (1024/1024/1024/1024) AS TABLE_SIZE_GB
FROM v_monitor.projection_storage
GROUP BY anchor_table_schema,
anchor_table_name
order by sum(used_bytes) desc;
有几种方法可以获取数据库的大小,每种方法都适用于稍微不同的用例。请务必注意,Vertica 以不同的方式使用原始数据和压缩数据,并且您应该注意您需要的大小。例如,许可基于原始数据大小。
原始尺寸
原始大小对于容量规划或监控许可证利用率很有用(这是数据在未压缩时占用的空间)。要获取整个数据库的原始数据大小,可以使用该
GET_COMPLIANCE_STATUS()
函数,也可以查询系统表v_internal.license_audits
。该
GET_COMPLIANCE_STATUS()
函数检索有关最近审计的信息。审计估计数据库的原始数据大小并将信息存储在v_internal.license_audits
. 默认情况下,审核在每天 23:59 进行,可以配置或手动运行。这是一些示例输出:
如果有权限,可以直接查询
license_audits
表:此外,如果您希望在架构级别获得原始数据大小,您可以使用它(来自vertica.tips):
压缩尺寸
压缩后的大小是磁盘上数据的实际大小。这对于估计磁盘空间使用情况很有用,因为 Vertica 建议始终至少有 40% 的空间可用。
column_storage
您可以从系统表或projection_storage
系统表中获取压缩大小。Using
projection_storage
还将返回任何空表(来自vertica.tips):最近的更新将值 v_catalog.licensing_audits 从常量“vertica”更改为三个不同的值 - Regular、Flex 和 Total。如果原始查询没有提供合理的结果,请尝试以下操作:
使用以下查询,您将获得vertica中表的确切大小。
解释如下:
https://www.orahow.com/2018/06/how-to-check-size-of-tables-in-vertica.html