Q

How to use Oracle table extents to allocate less disk space

Oracle expert Brian Peasland explains how to use table extents to allocate less disk space in Oracle.

I have a table in Oracle 10g which has about 5.7 billion records and is split into 500 partitions. The disk space occupied by the table is much larger than what I think it should be.

I query dba_partitions for one specific partition and get avg_row_len = 27 and num_rows = 411482598. This should equate to about 10.34 GB (Select 411482598 * 27 / Power (1024,3) From Dual). The blocks column in this table is 1653190 which equates to a size of about 12.61 GB (Select 1653190 * 8192 / Power (1024,3) From Dual). So far, I am happy.

Now I query dba_segments with the table name and partition name and get bytes = 26549944320. This equates to a size of 24.73GB, which is almost double what I found from dba_partitions. Why is this happening and is there a way to fix this?

Keep in mind that a segment is composed of one or more extents. And those extents are a specific size. Let's assume the extent size is 1MB and my table has two rows of data, each averaging 1KB in size. The size from your calculations would be 2KB in total size, yet querying DBA_SEGMENTS would show the table is 1MB in size. This is because I cannot have less than one extent in the segment. If you want to allocate less space, recreate the table with a smaller extent size.
This was first published in February 2009

Dig deeper on Oracle database backup and recovery

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close