Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can i get a table size with sql?

Status
Not open for further replies.

mokesql

Programmer
Sep 6, 2001
30
0
0
AT
hi!
i want ot know if there is a select type in sql or any other statement in sql which get me the size of a table. thnx

kemo
 

If you have access to DBA_SEGMENTS view, you can issue the following sql:

-- for all tables

SELECT owner, segment_name, SUM(bytes)
FROM DBA_SEGMENTS
WHERE segment_type = 'TABLE'
GROUP BY owner, segment_name


 
You may also want to use user_tables if you have updated statistics on your tables.
 

A few correction on my sql, no need of grouping the result here:

SELECT owner, segment_name, bytes
FROM DBA_SEGMENTS
WHERE segment_type = 'TABLE';

OR

SELECT owner, segment_name, SUM(bytes)
FROM DBA_EXTENTS
WHERE segment_type = 'TABLE'
GROUP BY owner, segment_name;

You can also use USER_EXTENTS view here.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top