How to query the size of table footprint in db

Source: Internet
Author: User

Both Oracle and DB2 support partitioned tables, but we need to know what tables are appropriate for partitioning table technology, and Oracle's official recommendation is to use partitioned tables for more than 2G table.

Here's a summary of how you can get these size information in each DB:

Oracle 10G:

Queries the size of the space occupied by the current user's table and arranges by size in descending order:

Select segment_name,sum (bytes)/1024/1024 from User_extents Group by segment_name Order by Sum (bytes)/1024/1024

Query the size of the system tablespaces and arrange them in descending order of size (requires SYSDBA permissions):

Select tablespace_name,sum (bytes)/1024/1024 from Dba_segments Group by Tablespace_name Order by Sum (bytes)/1024/1024 Desc

This can also be seen in the OEMC, but if it is not installed, the SQL statement is more convenient.

In DB2:

Viewing the size of a table can be viewed in a graphical interface in the control center.

In SQL Server:

Perform statistics and view the table size for the specified table name:

EXEC sp_spaceused ' table name ', true;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.