On Sat, Oct 25, 2014 at 8:15 AM, Stephen Chrzanowski <pontia...@gmail.com>
wrote:

>
> SQLite apparently will load an entire row of data out of the database, even
> if the query doesn't need the additional data, so if you have a huge blob,
> it'll read in that entire blob then toss the blob to /dev/null
>

SQLite only loads a prefix of each row from the file - the minimum prefix
required to resolve the query.  So if the BLOB is out on the end of the
row, it does not get loaded.

However, when updating a row, SQLite rewrites the entire row.  (It has to,
because of the use of variable-width encodings, since a change to any field
effects the location of all subsequent fields.)  So if you have a row with
both a BOOLEAN and a 1MB BLOB, you have to write 1MB in order to change the
value of the BOOLEAN.

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to