In Oracle, you can use the "select round(sum(BYTES)/1024/1024,2)||'M' from dba_segments where segment_name='table name'" statement to query the size of the table.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
How does oracle query the size of the table
There are two meanings of table size. One is the amount of physical space allocated to a table, regardless of whether the space is used. You can query the number of bytes like this:
select segment_name, bytes from user_segments where segment_type = 'TABLE';
or
Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name
The space actually used by another table. Query like this:
analyze table emp compute statistics; select num_rows * avg_row_len from user_tables where table_name = 'EMP';
View the size of each table space
Select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group By Tablespace_Name
Recommended tutorial: "Oracle Tutorial"
The above is the detailed content of How to query the size of a table in oracle. For more information, please follow other related articles on the PHP Chinese website!