On Oct 5, 2008, at 4:55 PM, yaroslavp wrote:

>
> Hi all,
>
> For testing purposes, I created a single row with a large blob   
> (hundreds of
> megs) in my database. There is also an integer column. When I do an  
> update
> on the integer, the query is very slow, and there's a lot of disk  
> activity.

SQLite updates an entire row at a time.  So when you change the  
integer, it has to rewrite both the integer and the BLOB.

SQLite has to do this because the fields of a row are of varying  
length.  Integers, for example, are stored in between 1 and 9 bytes  
depending on their magnitude.  If you change the value of an integer  
it might change the amount of storage it requires, which then requires  
rewriting everything that comes afterwards.

It is recommended that large BLOBs be stored in a separate table with  
only an INTEGER PRIMARY KEY.

D. Richard Hipp
[EMAIL PROTECTED]



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

Reply via email to