Table size and column size

Source: Internet
Author: User

The table size has two meanings. One is the number of physical spaces allocated to a table, regardless of whether the space is used or not. You can query the number of bytes as follows:

SELECT segment_name, BYTES
FROM user_segments
WHERE segment_type = 'table ';

 

Space actually used by another table. Query: the maximum size of a row.

Analyze table emp compute statistics;
SELECT num_rows * avg_row_len
FROM user_tables
WHERE table_name = 'emp ';

 

What is the maximum size of a row in an Oracle table? The answer depends on the version of Oracle used. 8.0 and later versions are 4000 GB (each LOB4GB, each table can have a maximum of 1000 LOB columns ). For structured data, varchar2 can contain a maximum of 4000 bytes and char can contain a maximum of 2000*4000 = 1000 bytes.

Oracle 7.x, each table has a maximum of 254 columns and varchar2 has a maximum of 2000 bytes. Therefore, the total structured data is 508,000 bytes. Or each table can have at most one long type, 2 GB.

Query the minimum, average, and maximum sizes of a table column: The 'vsize' function cannot be used for LONG/BLOB columns. You can use 'dbms _ lob. getlength (blob-field )'.

Select min (VSIZE (c1), AVG (VSIZE (c1), MAX (VSIZE (c1 ))
FROM t1;

 

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.