Actually it does. Sort of. The beginning of the record is the "manifest" (actual type of data list) area. This contains tokens representing the actual type/contents of the fields. Sticking with the example this will be 99 bytes containing the tokens "null", "zero", "one" and "integer" followed by one variable sized token "blob".
The length of the manifest is stored in it's first field, giving the offset of the "payload" (data item list) which contains the 0-99 variable sized integers that are not NULL, 0 or 1, followed by the actual blob data. So the amount of work required to locate the blob data varies considerably. -----Urspr?ngliche Nachricht----- Von: Simon Slavin [mailto:slavins at bigfraud.org] Gesendet: Freitag, 01. Mai 2015 11:32 An: General Discussion of SQLite Database Betreff: Re: [sqlite] Does column order matter for performance? On 1 May 2015, at 6:49am, Pol-Online <info at pol-online.net> wrote: > I?m curious: how much work are we talking about here? If I have 99 INTEGER > fields followed by a BLOB one, to access the BLOB field, does SQLite need to > compute the size of each previous INTEGER field first? Given the way that SQLite uses different sized fields for different integers, yes. Also, given that SQLite columns have affinity and not type, it has to calculate these sizes separately for each row retrieved. It can't use the table definition and calculate one set of positions for all rows. Fortunately, the lengths of all columns in a row can be calculated by looking at the serial types of all the columns, which are stored in a block at the beginning of the row data. So the format is not Type of column 1, data 1, type of column 2, data 2, type of column 3, data 3 ... it is Type of column 1, type of column 2, type of column 3 ..., data 1, data 2, data 3 ... so SQLite doesn't have to read through variable-sized data to work out where later columns are. More info in places around section 2.1 of <http://www.sqlite.org/fileformat.html> Simon. _______________________________________________ sqlite-users mailing list sqlite-users at 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: hick at 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.