Documentation Source Text

Check-in [316be08907]
Login

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

Overview
Comment:Fix typos in queryplaner.html
Timelines: family | ancestors | descendants | both | branch-3.10
Files: files | file ages | folders
SHA1: 316be089075659eae75ca4782ee6ca6ed7f68d4a
User & Date: drh 2016-01-14 16:10:04
Context
2016-01-14
17:58
Fix another typo in the query planner document. check-in: 47810e77ef user: drh tags: branch-3.10
16:10
Fix typos in queryplaner.html check-in: 316be08907 user: drh tags: branch-3.10
2016-01-13
21:46
Add the release hashes to the change log for 3.10.1. check-in: 9c12cf4cea user: drh tags: branch-3.10
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to pages/queryplanner.in.

     1      1   <title>Query Planning</title>
     2      2   <tcl>
     3      3   hd_keywords {indexing} {indexing tutorial}
     4      4   proc figure {fignum tag img title} {
            5  +  if {$tag!=""} {
            6  +    set tag [string trim $tag #]
            7  +    hd_puts "<a name='$tag'></a>\n"
            8  +  }
     5      9     hd_puts "<p><center>\n"
     6     10     hd_puts "<img src=\"images/qp/$img\" alt=\"figure $fignum\"><br>\n"
     7     11     hd_puts "Figure $fignum: $title\n"
     8     12     hd_puts "</center></p>\n"
     9     13   }
    10     14   proc code {txt} {
    11     15     hd_puts "<center><table><tr><td><pre>\n"
................................................................................
   119    123   
   120    124   <tcl>code {
   121    125   SELECT price FROM fruitsforsale WHERE rowid=4;
   122    126   }</tcl>
   123    127   
   124    128   <p>
   125    129   Since the information is stored in the table in rowid order, SQLite
   126         -can find the correct row using doing a binary search on the rowid.
          130  +can find the correct row using a binary search on the rowid.
   127    131   If the table contains N element, the time required to look up the
   128    132   desired row is proportional to logN rather than being proportional
   129    133   to N as in a full table scan.  If the table contains 10 million elements,
   130    134   that means the query will be on the order of N/logN or about 1 million
   131    135   times faster!
   132    136   </p>
   133    137   
................................................................................
   142    146   
   143    147   <p>
   144    148   To make the original query more efficient, we can add an index on the
   145    149   "fruit" column of the "fruitsforsale" table like this:
   146    150   </p>
   147    151   
   148    152   <tcl>code {
   149         -CREATE INDEX idx1 ON fruitsforsale(fruit);
          153  +CREATE INDEX Idx1 ON fruitsforsale(fruit);
   150    154   }</tcl>
   151    155   
   152    156   <p>
   153    157   An index is another table similar to the original "fruitsforsale" table
   154    158   but with the content (the fruit column in this case) stored in front of the
   155    159   rowid and with all rows in content order.
   156    160   <a href="#fig4">Figure 4</a> gives a logical view of the Idx1 index.
................................................................................
   260    264   </tcl>
   261    265   
   262    266   <p>
   263    267   The "state" index works just like the "fruit" index in that it is a
   264    268   new table with an extra column in front of the rowid and sorted by
   265    269   that extra column as the primary key.  The only difference is that
   266    270   in Idx2, the first column is "state" instead of "fruit" as it is with
   267         -Idx1.  In our example data set, the is more redundancy in the "state"
          271  +Idx1.  In our example data set, there is more redundancy in the "state"
   268    272   column and so they are more duplicate entries.  The ties are still
   269    273   resolved using the rowid.
   270    274   </p>
   271    275   
   272    276   <p>
   273    277   Using the new Idx2 index on "state", SQLite has another option for
   274    278   lookup up the price of California oranges:  it can look up every row