Il 07/08/2018 19:41, Abroży Nieprzełoży ha scritto:
> substr(data, start, len) loads entire value and then substrs it.
> sqlite3_blob_read reads the desired parts.

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?

> 
> 2018-08-06 20:59 GMT+02:00, Abramo Bagnara <abramo.bagn...@bugseng.com>:
>> Il 04/08/2018 07:07, Abramo Bagnara ha scritto:
>>> Il 03/08/2018 23:53, Abroży Nieprzełoży ha scritto:
>>>> -- One table with whole files
>>>> CREATE TABLE content(
>>>>         id INTEGER PRIMARY KEY,
>>>>         data BLOB NOT NULL
>>>> );
>>>> -- And second table with line boundaries
>>>> CREATE TABLE lines(
>>>>         id INTEGER NOT NULL REFERENCES content(id),
>>>>         line_no INTEGER NOT NULL,
>>>>         bytes_from INTEGER NOT NULL,
>>>>         bytes_to INTEGER NOT NULL,
>>>>         PRIMARY KEY(id, line_num)
>>>> ) WITHOUT ROWID;
>>>> -- Use Incremental BLOB I/O https://www.sqlite.org/c3ref/blob_open.html
>>>
>>> Incremental BLOB I/O is faster than using substr(data, start, len) in a
>>> SELECT?
>>
>> Someone familiar with implementation of BLOB I/O and sqlite VM can
>> answer to that?
>>
>> I'd guess that *if* there is a difference it is greater with bigger
>> blobs, but it is also possible there is not any sensible difference if
>> substr act similarly to sqlite3_blob_read.
>>
>> But my uninformed guesses are definitely not relevant, until an aware
>> Samaritan will come to clarify that ;-)
>>

-- 
Abramo Bagnara

BUGSENG srl - http://bugseng.com
mailto:abramo.bagn...@bugseng.com
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to