I was wondering how much memory does a null value occupy in a database can anyone answer clearly?
Asked
Active
Viewed 1,589 times
10
-
1Depends on the database - IE SQL Server: http://weblogs.sqlteam.com/mladenp/archive/2007/09/06/How_does_SQL_Server_really_store_NULL-s.aspx – OMG Ponies May 03 '11 at 04:42
-
NULL is not a value - it's the **absence** of a value. Shouldn't be occupying any space at all (since there is nothing to store, really....) – marc_s May 03 '11 at 04:42
-
**Memory**? Don't you confuse it with disk storage? And what dbms do you use? – zerkms May 03 '11 at 04:42
-
2@marc_s: you're completely wrong ;-) – zerkms May 03 '11 at 04:43
-
2@zerkms I'm pretty sure marc_s was making a joke. – Conrad Frix May 03 '11 at 04:47
-
2I highly suggest reasking this question on http://dba.stackexchange.com – jcolebrand May 03 '11 at 04:47
-
@zerkms Trust me, too many people confuse memory with disk usage. – BoltClock May 03 '11 at 04:49
-
I wonder if CJ Date dies a little inside every time a question like this gets asked. A NULL question and storage question in one – Conrad Frix May 03 '11 at 04:51
-
1@Conard Frix No theoritically marc_s may be wrong but practically he is right how database knows whether an entry is null it should have something like flag to say its a null. – satheesh.droid May 03 '11 at 04:51
1 Answers
5
How much space it takes up depends on what the column is defined to be and on the storage engine being used. Some data types take a fixed amount of space regardless of the data stored. There is a small space penalty for declaring a column to accept NULL. Details can be found in this general discussion in the manual and more in the docs about each storage engine.

Ted Hopp
- 232,168
- 48
- 399
- 521