Wednesday, October 23, 2019, 1:53:10 PM, x <tam118...@hotmail.com> wrote:
> From the documentation > A record might have fewer values than the number of columns in the > corresponding table. This can happen, for example, after an ALTER TABLE ... > ADD COLUMN SQL statement has increased the number of > columns in the table schema without modifying preexisting rows in the table. > Missing values at the end of the record are filled in using the default value > for the corresponding columns defined in > the table schema. > Suppose you have a table with say 5 columns that are almost always > the default value (probably zero or null). Does the above suggest > you should make them the last 5 columns in the table as the last > n columns that are the default value wont take up space? Or does > this state just exist after ADD COLUMN but any rows added thereafter > use the space? I believe it can only happen after an ADD COLUMN, however, zero or NULL values will, essentially, take zero space whereever they are in a row. If you look in-and-around: https://www.sqlite.org/fileformat.html#record_format, you will see that the "type code" used for each column in a row has specific values for "NULL" and zero (0 and 8, respectively). This means that where those NULL/zero occurs, no extra space is used to hold the value. Graham _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users