Home > Database > Oracle > body text

How to query the size of a table in oracle

WBOY
Release: 2022-01-05 15:06:37
Original
31183 people have browsed it

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.

How to query the size of a table in oracle

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';
Copy after login

or

   Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name
Copy after login

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';
Copy after login

View the size of each table space

Select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group By Tablespace_Name
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template