The size of the null value list is one byte in mysql Innodb with compact row format. If there are many columns with null values, won't they overflow.
Asked
Active
Viewed 46 times
-1
-
Where did you find this?: "The size of the null value list is one byte in mysql". This seems to be incorrect, see also https://stackoverflow.com/questions/3731172/how-much-size-null-value-takes-in-sql-server – Jonas Metzler May 13 '22 at 04:26
-
that is incorrect, that's the size of the column, not the actual NULL value, its even said in the link you posted – Demeteor May 13 '22 at 04:29
-
Edit 2: you edited your post while I was posting. initially, it seemed like you said NULL was 1 byte – Demeteor May 13 '22 at 04:32
1 Answers
1
I am not sure I understand the question. but a NULL value is not an empty string and it's also not an empty value/number. it takes zero space. so having millions of null values or just one. it's exactly the same thing.
I guess if I were to imagine null to a real-world example, I would imagine nothing. since null means something that's not there. even when you close your eyes, you basically see darkness. with null darkness is not there.

Demeteor
- 1,193
- 2
- 17
- 33
-
Thank you!,I mean the space used to record which fields are null in one row. – Pengfei Xu May 13 '22 at 05:11
-
NULL does not take any space, the column occupies space in the database, but this is dependent on which database you use and which version. But null on its own does not exist. it's tricky to explain null. Now I believe that a column on itself takes up 1byte maybe 2. but this has nothing to do with NULL itself. as I keep repeating NULL is nothing. – Demeteor May 13 '22 at 05:51