Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do null SQLite Data fields take up extra memory?

I'm using the built in sqlite library on the Android platform.

I'm considering adding several general purpose fields that users will be able to use for their own custom applications, but these fields will be blank most of the time.

My question is, how much overhead will these blank fields add to my database? Do null fields even take up per record memory in sqlite? If so, how much? I don't quite understand the inner workings of a sqlite database.

like image 646
CodeFusionMobile Avatar asked May 09 '10 17:05

CodeFusionMobile


1 Answers

The SQLite file format is described here. A NULL field will take one byte.

One way to provide custom/optional fields is to put them in a separate table with a foreign key identifying the corresponding record. Then no additional record is required if there are no custom fields, though there will be a need to do joins to gather all the fields when there are custom fields.

like image 117
Doug Currie Avatar answered Sep 24 '22 01:09

Doug Currie