epsac
epsac

Reputation: 198

Will blank fields (i.e. columns) in Oracle table still eat disk space?

For example, I have the following employee table:

emp_id - name - address

1234 ---- alex ---- (null)

1235 -----john ---- (null)

Notice that I did not put anything in the address column.

Will the address column still consume disk space even if I didn't put anything to it?

I ask this question because I am planning the delete some columns in a particular table. This table has about fifty (50) columns but only fifteen (15) columns are being used. I need to find out if the other thirty-five (35) columns (which are not being used) are still taking up disk space even if you didn't put anything on it.

Your response is highly appreciated.

Upvotes: 2

Views: 1407

Answers (2)

APC
APC

Reputation: 146349

From the section about table storage in the Concepts Guide

"Nulls are stored in the database if they fall between columns with data values. In these cases, they require 1 byte to store the length of the column (zero). Trailing nulls in a row require no storage..."

So in the precise case you posted in your question the answer would be that the address column doesn't take up any space. But other columns with nulls might.

Upvotes: 1

user1658435
user1658435

Reputation: 574

Space will be taken up by the address column depending upon the database you are using. You can reclaim the space used, but if it is Oracle, unused space is "Never" used space. You can reclaim the space with different techniques one of them is like alter table MY_TABLE deallocate unused keep xx; altering the table to deallocate unused space is the most generally used way to reclaim the space

Upvotes: 0

Related Questions