Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
maxyvelez
Contributor
Contributor

Null values stored in disk

I'm trying to understand why NullTable is bigger in size than Table, can anyone explain please?

 

NullTable:
LOAD
Null() as Field1,
Null() as Field2,
Null() as Field3,
Null() as Field4,
Null() as Field5,
Null() as Field6,
Null() as Field7,
Null() as Field8,
Null() as Field9,
Null() as Field10,
-1 as Field11
AutoGenerate 300000000
;

STORE NullTable into [NullTable.qvd];
DROP Table NullTable;

Table:
LOAD
-1 as Field1,
-1 as Field2,
-1 as Field3,
-1 as Field4,
-1 as Field5,
-1 as Field6,
-1 as Field7,
-1 as Field8,
-1 as Field9,
-1 as Field10,
-1 as Field11
AutoGenerate 300000000
;

STORE Table into [Table.qvd];
DROP Table Table;

maxyvelez_0-1661875656357.png

 

Labels (1)
1 Solution

Accepted Solutions
deepanshuSh
Creator III
Creator III

Hi Max, You put up an quite an interesting observation. lets deduce the answer based on the space occupied by each character, the null value by default occupies a space of around 4 bytes in the SQL storage which is most probably the same for the qliksense as well. When comparing it with the varchar/integer input of the values like 1 or -1 that you have used, it takes up the space based on the length of the character like 1 has around 1 or even less bytes space accommodated to it as compared to 11 or 111 input. 

Thus, the null input has around 4 bytes while a character (-1) has around 1 byte or even less, resulting in higher size of qvd of null as compared to table qvd. 

Trial and error is the key to get unexpected results.

View solution in original post

2 Replies
deepanshuSh
Creator III
Creator III

Hi Max, You put up an quite an interesting observation. lets deduce the answer based on the space occupied by each character, the null value by default occupies a space of around 4 bytes in the SQL storage which is most probably the same for the qliksense as well. When comparing it with the varchar/integer input of the values like 1 or -1 that you have used, it takes up the space based on the length of the character like 1 has around 1 or even less bytes space accommodated to it as compared to 11 or 111 input. 

Thus, the null input has around 4 bytes while a character (-1) has around 1 byte or even less, resulting in higher size of qvd of null as compared to table qvd. 

Trial and error is the key to get unexpected results.
maxyvelez
Contributor
Contributor
Author

Thank you very much for your answer, that clarifies a lot for me. So, I can conclude that is better to fill the null values with  a character!. Thanks again.