Need a query to find the database size in your Netezza? Run the query below:
(
SELECT 'Database ' AS "Object",
subselect.database::nvarchar(128) AS "Name"
, TO_CHAR ( nvl(SUM ( used ),0) , '999,999,999,999,999' ) AS "Bytes"
, TO_CHAR ( nvl(SUM ( used ),0) / ( 1024 ) , '999,999,999,999' ) AS "KB"
, TO_CHAR ( nvl(SUM ( used ),0) / ( 1048576 ) , '999,999,999' ) AS "MB"
, TO_CHAR ( nvl(SUM ( used ),0) / ( 1073741824 ) , '999,999.0') AS "GB"
, TO_CHAR ( nvl(SUM ( used ),0) / ( 1099511627776 ) , '999.0') AS "TB"
FROM
(
SELECT database
,0::bigint AS used
FROM _v_database
WHERE database not in ('master_db', 'MASTER_DB')
UNION ALL
SELECT the_table.database
,SUM ( used_bytes ) as used
FROM _V_OBJ_RELATION_XDB the_table
left outer join _V_SYS_OBJECT_DSLICE_INFO on
( the_table.objid = _V_SYS_OBJECT_DSLICE_INFO.tblid and
_V_SYS_OBJECT_DSLICE_INFO.tblid > 200000
)
WHERE the_table.objclass in (4905,4910,4940,4959,4951,4953,4961,4963)
and the_table.objid > 200000
GROUP BY the_table.visibleid
,the_table.database
) subselect
GROUP BY "Name"
)
UNION ALL
(
SELECT
'Appliance' AS "Object",
'CELDNTZ1 '::nvarchar(128) AS "Name"
, TO_CHAR ( nvl(SUM ( used ),0) , '999,999,999,999,999' ) AS "Bytes"
, TO_CHAR ( nvl(SUM ( used ),0) / ( 1024 ) , '999,999,999,999' ) AS "KB"
, TO_CHAR ( nvl(SUM ( used ),0) / ( 1048576 ) , '999,999,999' ) AS "MB"
, TO_CHAR ( nvl(SUM ( used ),0) / ( 1073741824 ) , '999,999.0') AS "GB"
, TO_CHAR ( nvl(SUM ( used ),0) / ( 1099511627776 ) , '999.0') AS "TB"
FROM
(
SELECT
SUM ( used_bytes ) as used
FROM _V_OBJ_RELATION_XDB the_table
left outer join _V_SYS_OBJECT_DSLICE_INFO on
( the_table.objid = _V_SYS_OBJECT_DSLICE_INFO.tblid and
_V_SYS_OBJECT_DSLICE_INFO.tblid > 200000
)
WHERE the_table.objclass in (4905,4910,4940,4959,4951,4953,4961,4963)
and the_table.objid > 200000
GROUP BY the_table.visibleid
) subselect
)
order by 1 ASC, 2 ASC
Sample Output:
Object Name Bytes KB MB GB TB
Appliance CELDNTZ1 6,014,002,790,400 5,873,049,600 5,735,400 5,601.0 5.5
Database CELEBI_STG_PROD_DB 1,535,959,891,968 1,499,960,832 1,464,806 1,430.5 1.4
Database AIU_HTTP_DB 840,035,467,264 820,347,136 801,120 782.3 .8
Database CELENR_HLD_PROD_DB 739,612,426,240 722,277,760 705,349 688.8 .7
Database CELEBI_NBA_DDS_DB 471,286,415,360 460,240,640 449,454 438.9 .4
Database SYSTEM 395,920,801,792 386,641,408 377,580 368.7 .4
No comments:
Post a Comment