Dear,

Let:

        create table DATA (
          DKEY blob primary key not null,
          DBYTES blob not null );

DKEY always stores 32 bytes, inserted as blob.
DBYTES stores anything, inserted as blob. Size varies widely, from some about 
100 bytes to some hundreds Kilo-bytes.
Page size is default (4K).
These rows are never updated, only inserted (or selected) and very rarely 
deleted.

Will:

        select length(DBYTES) from DATA where DKEY=x'...';

be relatively light to retrieve the length(DBYTES) in some rare cases I'd need 
it (without needing the actual content)? Or will this have the unwanted 
side-effect to force sqlite to read all the content of DBYTES?
I know the encoding of the blob in the row has its size upfront, so I'd guess 
I'd be right to expect it won't do unneeded I/O to return the length(). But I'm 
not sure of this and wonder if I'd better cache the size in a separate column 
as in:

        create table DATA (
          DKEY blob primary key not null,
          DSIZE integer not null,
          DBYTES blob not null );

So if someone can confirm/infirm this assertion (about length(DBYTES) not 
involving needless I/O), I'd love to read you.

Thanks!

-- 
Best Regards, Meilleures salutations, Met vriendelijke groeten,
Olivier Mascia, http://integral.software


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

Reply via email to