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.