Tuesday, August 07, 2018, 7:36:26 PM, Abramo Bagnarawrote:

> I've verified that not only substr(data, start, len) loads entire row,
> but with my surprise that also retrieving a sibling column (I've tried
> to add another column "info blob not null") loads entire row (i.e.
> including whole data column)...

> IOW "select info from content;" retrieves also data column content.

> Weird, isn't it?

If the "info" column is added to the end of the table, then this is a
well-known "optimisation opportunity"... because of the way SQLite
stores records, it has to read past all intervening columns to get to
the ones required. If "info" is after your BLOB, the BLOB has to be
read to get to it. A common "good practice" is to ensure any BLOB (or
similar large fields) are placed at the end of the table definition.

If the "info" column is added _before_ the BLOB, it _should_ (as I
understand it) not need to read the blob to handle "select info from
content".

Graham



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

Reply via email to