Here is the description of the internal record format

https://www.sqlite.org/fileformat.html#record_format

In comparison to a traditional C record structures it does a pretty good job 
when it comes to number of bytes stored. Especially if you have long string 
fields to accommodate insane xml content that is mostly very much shorter than 
the maximum size you are obliged to cater for.


-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Jay Kreibich
Gesendet: Donnerstag, 06. Oktober 2016 16:49
An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
Betreff: *** suspected spam or bulk *** Re: [sqlite] Order of fields for insert

On Thu, Oct 6, 2016 at 9:25 AM, Hick Gunter <h...@scigames.at> wrote:

> SQLite compresses rows before storing and decompresses rows before
> returning fields. BLOB fields are the most time consuming to process
> and so should be placed at the end of the row. Often used fields -
> i.e. (foreign) key fields - should be placed at the front of the row.
> This will help most if your select field list is limited to the fields
> you actually need instead of "*".
>
>
Sorta, kinda, but not really.  SQLite does not use a traditional data 
compression algorithm in storing row data, but it does "pack" rows into a 
compact format (including variable size integers).  As such, a row's worth of 
data, as stored in the raw database, acts very similar to a compressed block of 
data... you have to read it from the start and can't directly jump to a field 
in a middle of it.

This is the issue with column ordering; the data engine will only read and 
unpack the columns it needs, but it has to read and unpack the columns in the 
order they're defined until it gets all the columns it needs.  This makes it 
generally better to put more frequently accessed and/or smaller values at the 
start of a row.

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


___________________________________________
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.


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

Reply via email to