简体   繁体   English

null SQLite数据字段是否会占用额外的内存?

[英]Do null SQLite Data fields take up extra memory?

I'm using the built in sqlite library on the Android platform. 我在Android平台上使用内置的sqlite库。

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? 空字段甚至占用sqlite中的每个记录内存吗? If so, how much? 如果是这样,多少钱? I don't quite understand the inner workings of a sqlite database. 我不太了解sqlite数据库的内部工作原理。

The SQLite file format is described here . 这里描述 SQLite文件格式。 A NULL field will take one byte. NULL字段将占用一个字节。

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. 如果没有自定义字段,则不需要其他记录,但是当存在自定义字段时,需要进行连接以收集所有字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM