0% found this document useful (0 votes)
78 views2 pages

Oracle9i - Table Sizes

The document discusses using Oracle SQL commands to analyze the storage size of a table called size_test. It shows that while deleting half the records reduced the actual data size by 50%, the storage space used on disk remained the same, as Oracle does not immediately free up space when data is deleted.

Uploaded by

api-3766428
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views2 pages

Oracle9i - Table Sizes

The document discusses using Oracle SQL commands to analyze the storage size of a table called size_test. It shows that while deleting half the records reduced the actual data size by 50%, the storage space used on disk remained the same, as Oracle does not immediately free up space when data is deleted.

Uploaded by

api-3766428
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

The generated data looks like:

RENE> select * from size_test where rownum < 10;

A B

---------- --------------------

1 Q48VY

2 KJ5HD6LKFV244NH

1 RIXX8YFSHKVJ19Z2A8

2 FVBZEHJOL5YY3JN

1 GTEG14

2 0EFKM

1 3PKZYH992LJDXEW1

2 XZUNF3E9

1 TAVL4K98L3G8CM8

Now, using vsize, I want to calculate the amount of data in bytes stored in the table:
RENE> select sum(vsize(a) + vsize(b)) data_size from size_test;

DATA_SIZE

----------

1451138

Obviously, the table stores 1451138 bytes worth of data.


But how many bytes are actually stored on disk? user_segments tells me!
RENE> select bytes from user_segments where segment_name =
'SIZE_TEST';

BYTES

----------

2490368
Deleting data
I delete half of the data:
RENE> delete from size_test where a = 2;

What is the size of the actual data?


RENE> select sum(vsize(a) + vsize(b)) data_size from size_test;

DATA_SIZE

----------

725662

It has reduced by 50% as well. But what about the size of the needed storage?
RENE> select bytes from user_segments where segment_name =
'SIZE_TEST';

BYTES

----------

2490368

It remaind exactly the same. When data is deleted, Oracle does not free storage space.

You might also like