Documentation Source Text

Check-in [f26e661484]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge typo fixes from the 3.10 branch.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f26e6614844643e408d205bd7c72415087806987
User & Date: drh 2016-02-10 03:48:51
Context
2016-02-10
13:51
Merge download page enhancements from the 3.10 branch. check-in: dd43be4bec user: drh tags: trunk
03:48
Merge typo fixes from the 3.10 branch. check-in: f26e661484 user: drh tags: trunk
03:47
Fix typos in the fileformat2.html document. check-in: 7ee2137b43 user: drh tags: branch-3.10
2016-02-09
22:53
Updates to talk about the auto-explain changes to the shell. check-in: 5a67b7f178 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to pages/fileformat2.in.

   496    496   that consists of a single page that is both a leaf and the root.
   497    497   Because there are pointers from parents to children, every page of a
   498    498   complete b-tree can be located if only the root page is known.  Hence,
   499    499   b-trees are identified by their root page number.</p>
   500    500   
   501    501   <p>A b-tree page is either a table b-tree page or an index b-tree page.
   502    502   All pages within each complete b-tree are of the same type: either table
   503         -or index.  There is a one table b-trees in the database file
          503  +or index.  There is one table b-trees in the database file
   504    504   for each rowid table in the database schema, including system tables
   505         -such as sqlite_master.  There is one index b-trees
          505  +such as sqlite_master.  There is one index b-tree
   506    506   in the database file for each index in the schema, including implied indexes
   507    507   created by uniqueness constraints.  There are no b-trees associated with
   508    508   [virtual tables].  Specific virtual table implementations might make use
   509    509   of [shadow tables] for storage, but those shadow tables will have separate
   510    510   entries in the database schema.  [WITHOUT ROWID] tables use index b-trees
   511    511   rather than a table b-trees, so there is one
   512    512   index b-tree in the database file for each [WITHOUT ROWID] table.
................................................................................
   642    642   
   643    643   <tcl>hd_fragment varint {variable-length integer} {varint}</tcl>
   644    644   
   645    645   <p>A variable-length integer or "varint" is a static Huffman encoding
   646    646   of 64-bit twos-complement integers that uses less space for small positive 
   647    647   values. 
   648    648   A varint is between 1 and 9 bytes in length.  The varint consists of either
   649         -zero or more byte which have the high-order bit set followed by a single byte
          649  +zero or more bytes which have the high-order bit set followed by a single byte
   650    650   with the high-order bit clear, or nine bytes, whichever is shorter.
   651    651   The lower seven bits of each of the first eight bytes and all 8 bits of
   652    652   the ninth byte are used to reconstruct the 64-bit twos-complement integer.
   653    653   Varints are big-endian: bits taken from the earlier byte of the varint
   654    654   are the more significant than bits taken from the later bytes. </p>
   655    655   
   656    656   <p>The format of a cell depends on which kind of b-tree page the cell
................................................................................
   683    683   pages.
   684    684   <li>A 4-byte big-endian integer page number for the first page of the
   685    685   overflow page list - omitted if all payload fits on the b-tree page.
   686    686   </ul></p></dd>
   687    687   
   688    688   <dt><p>Index B-Tree Interior Cell (header 0x02):</p></dt>
   689    689   <dd><p><ul>
   690         -<li>A 4-byte big-endianpage number which is the left child pointer.
          690  +<li>A 4-byte big-endian page number which is the left child pointer.
   691    691   <li>A varint which is the total number of bytes of key payload, including any
   692    692   overflow
   693    693   <li>The initial portion of the payload that does not spill to overflow
   694    694   pages.
   695    695   <li>A 4-byte big-endian integer page number for the first page of the
   696    696   overflow page list - omitted if all payload fits on the b-tree page.
   697    697   </ul></p></dd>
................................................................................
   753    753   
   754    754   <blockquote><dl>
   755    755   <dt>Table B-Tree Leaf Cell:</dt>
   756    756   <dd><p>
   757    757   ^If the payload size P is less than or equal to U-35 then
   758    758   the entire payload is stored on the b-tree leaf page.  
   759    759   ^(Let M be ((U-12)*32/255)-23.  If P is greater than U-35
   760         -then the number of byte stored on the b-tree leaf page is the smaller of
          760  +then the number of bytes stored on the b-tree leaf page is the smaller of
   761    761   M+((P-M)%(U-4)) and U-35.)^
   762    762   ^(Note that number of bytes stored on the leaf page is never less than M.)^
   763    763   </p></dd>
   764    764   
   765    765   <dt>Table B-Tree Interior Cell:</dt>
   766    766   <dd><p>
   767    767   Interior pages of table b-trees have no payload and so there is never
................................................................................
   769    769   </p></dd>
   770    770   
   771    771   <dt>Index B-Tree Leaf Or Interior Cell:</dt>
   772    772   <dd><p>
   773    773   ^(Let X be ((U-12)*64/255)-23).  If the payload size P is less than
   774    774   or equal to X then the entire payload is stored on the b-tree page.)^
   775    775   ^(Let M be ((U-12)*32/255)-23.  If P is greater than X then the number
   776         -of byte stored on the b-tree page is the smaller of
          776  +of bytes stored on the b-tree page is the smaller of
   777    777   M+((P-M)%(U-4)) and X.)^
   778    778   ^(Note that number of bytes stored on the index page is never less than M.)^
   779    779   </p></dd>
   780    780   </dl></blockquote>
   781    781   
   782    782   <p>The overflow thresholds are designed to give a minimum fanout of
   783    783   4 for index b-trees and to make sure enough of the payload
................................................................................
   825    825   <p>^(In a database that uses ptrmap pages, all pages at locations identified
   826    826   by the computation in the previous paragraph must be ptrmap page and no
   827    827   other page may be a ptrmap page.  Except, if the byte-lock page happens to
   828    828   fall on the same page number as a ptrmap page, then the ptrmap is moved
   829    829   to the following page for that one case.)^</p>
   830    830   
   831    831   <p>Each 5-byte entry on a ptrmap page provides back-link information about 
   832         -one of pages that immediately follow the pointer map.  ^(If page B is a
          832  +one of the pages that immediately follow the pointer map.  ^(If page B is a
   833    833   ptrmap page then back-link information about page B+1 is provided by
   834    834   the first entry on the pointer map.  Information about page B+2 is
   835    835   provided by the second entry.  And so forth.)^</p>
   836    836   
   837    837   <p>Each 5-byte ptrmap entry consists of one byte of "page type" information
   838    838   followed by a 4-byte big-endian page number.  Five page types are recognized:
   839    839   </p>
................................................................................
  1010   1010   integer key for each entry in the table b-tree.</p>
  1011   1011   
  1012   1012   <p> ^The content of each SQL table row is stored in the database file by
  1013   1013   first combining the values in the various columns into a byte array
  1014   1014   in the record format, then storing that byte array as the payload in
  1015   1015   an entry in the table b-tree.  ^The order of values in the record is
  1016   1016   the same as the order of columns in the SQL table definition.
  1017         -^When an SQL table that includes an
         1017  +^When an SQL table includes an
  1018   1018   [INTEGER PRIMARY KEY] column (which aliases the [rowid]) then that
  1019   1019   column appears in the record as a NULL value.  ^SQLite will always use
  1020   1020   the table b-tree key rather than the NULL value when referencing the
  1021   1021   [INTEGER PRIMARY KEY] column.</p>
  1022   1022   
  1023   1023   <p> ^If the [affinity] of a column is REAL and that column contains a
  1024   1024   value that can be converted to an integer without loss of information
................................................................................
  1158   1158   and virtual tables, the rootpage column is 0 or NULL.</p>
  1159   1159   
  1160   1160   <p>^(The sqlite_master.sql column stores SQL text that describes the
  1161   1161   object.  This SQL text is a [CREATE TABLE], [CREATE VIRTUAL TABLE],
  1162   1162   [CREATE INDEX],
  1163   1163   [CREATE VIEW], or [CREATE TRIGGER] statement that if evaluated against
  1164   1164   the database file when it is the main database of a [database connection]
  1165         -would recreated the object.)^  The text is usually a copy of the original
         1165  +would recreate the object.)^  The text is usually a copy of the original
  1166   1166   statement used to create the object but with normalizations applied so
  1167   1167   that the text conforms to the following rules:
  1168   1168   
  1169   1169   <ul>
  1170   1170   <li>^The CREATE, TABLE, VIEW, TRIGGER, and INDEX keywords at the beginning
  1171   1171   of the statement are converted to all upper case letters.
  1172   1172   <li>^The TEMP or TEMPORARY keyword is removed if it occurs after the 
................................................................................
  1204   1204   
  1205   1205   <ul>
  1206   1206   <li><p>Indices with names of the form "sqlite_autoindex_TABLE_N" that
  1207   1207          are used to implement [UNIQUE] and [PRIMARY KEY] constraints on
  1208   1208          ordinary tables.
  1209   1209   
  1210   1210   <li><p>A table with the name "sqlite_sequence" that is used to keep track
  1211         -       of the maximum historical [INTEGER PRIMARY KEY] for a table that
         1211  +       of the maximum historical [INTEGER PRIMARY KEY] for a table
  1212   1212          using [AUTOINCREMENT].
  1213   1213   
  1214   1214   <li><p>Tables with names of the form "sqlite_statN" where N is an integer.
  1215   1215          Such tables store database statistics gathered by the [ANALYZE]
  1216   1216          command and used by the query planner to help determine the best
  1217   1217          algorithm to use for each query.
  1218   1218   </ul>
................................................................................
  1395   1395   that contain between 10 and 40 samples that are distributed across
  1396   1396   the key space and with large nEq values.
  1397   1397   
  1398   1398   <p>^(In a well-formed sqlite_stat3 table, the samples for any single
  1399   1399   index must appear in the same order that they occur in the index.  
  1400   1400   In other words, if the entry with left-most column S1 is earlier in
  1401   1401   the index b-tree than the
  1402         -entry with lef-most column S2, then in the sqlite_stat3 table, 
         1402  +entry with left-most column S2, then in the sqlite_stat3 table, 
  1403   1403   sample S1 must have a smaller rowid than sample S2.)^
  1404   1404   
  1405   1405   <tcl>hd_fragment stat4tab {sqlite_stat4} SQLITE_STAT4</tcl>
  1406   1406   <h4>2.6.6 The sqlite_stat4 table</h4>
  1407   1407   
  1408   1408   <p>The sqlite_stat4 is only created and is only used if SQLite is compiled
  1409   1409   with [SQLITE_ENABLE_STAT4] and if the SQLite version number is
................................................................................
  1462   1462       <td>^(The sqlite_stat4.nLt column holds a list of N integers where
  1463   1463       the K-th integer is the approximate number of entries in the
  1464   1464       index whose K left-most columns are collectively less than the 
  1465   1465       K left-most columns of the sample.)^
  1466   1466   
  1467   1467   <tr><td valign="top" align="right">nDLt:</td>
  1468   1468       <td>^(The sqlite_stat4.nDLt column holds a list of N integers where
  1469         -    the K-th integers is the approximate
         1469  +    the K-th integer is the approximate
  1470   1470       number of entries in the index that are distinct in the first K columns and
  1471         -    that are whose left-most K columns are collectively less than the left-most
         1471  +    where the left-most K columns are collectively less than the left-most
  1472   1472       K columns of the sample.)^
  1473   1473   </table>
  1474   1474   </center>
  1475   1475   
  1476   1476   <p>The sqlite_stat4 is a generalization of the sqlite_stat3 table.  The
  1477   1477   sqlite_stat3 table provides information about the left-most column of an
  1478   1478   index whereas the sqlite_stat4 table provides information about all columns