Get the App
SLTechnology News&Howtos  ›  Database  › 

Query the actual size of DB table

Shulou Source: shulou.com Published: 2022-06-01 22:25:24 09月28日 Update

1. Query the actual size of the DB table (ensure large clob/blob/nclob lob fields)

Select round (sum (bytes/1024/1024/1024), 2) | |'G' from dba_segments where owner=' user 'and segment_name =' table'OR segment_name IN (select SEGMENT_NAME from dba_LOBS where TABLE_NAME=' table 'and owner=' user')

If you are not a dba user, you can use user_segments & user_lobs and do not need owner.

two。 Query the large LOB field in the table

Select round (sum (b.BYTES/1024/1024), 2) | |'M' from dba_lobs a, dba_segments b where a.segment_name = b.segment_name and a.owner = 'user (uppercase)' and a.table_name = 'table (uppercase)'

3. Query table size without large LOB field

Select round (sum (bytes/1024/1024/1024), 2) | |'G' from user_segments where segment_name = 'table'

4. Table data is deleted

a. If the data of the table is truncate, the data found by the above method will change immediately.

b. If the data of the table is delete, the table needs to be shrunk before the above query will be changed.

Alter table table name enable row movement; alter table table name shrink space

Tags: Query data user field size uppercase lookup table change actual method a.memb. guarantee shrink Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL macOS vpn Apple MariaDB