/ Check-in [b9f91317]
Login

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

Overview
Comment:Fix long-standing typos in comments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental-costs
Files: files | file ages | folders
SHA1: b9f91317c34d07769a95dc2f905a6ccabceb64a3
User & Date: drh 2014-04-30 13:19:09
Context
2014-04-30
14:22
Improved rendering of LogEst values corresponding to real values near 0.0 in the tool/logest.c utility program. check-in: 32910c8c user: drh tags: experimental-costs
13:19
Fix long-standing typos in comments. check-in: b9f91317 user: drh tags: experimental-costs
2014-04-29
19:01
Test that the default values used when sqlite_stat1 data is not available are calculated correctly. Fixes for the same. check-in: e2d42f90 user: dan tags: experimental-costs
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/sqliteInt.h.

   521    521   
   522    522   /*
   523    523   ** Estimated quantities used for query planning are stored as 16-bit
   524    524   ** logarithms.  For quantity X, the value stored is 10*log2(X).  This
   525    525   ** gives a possible range of values of approximately 1.0e986 to 1e-986.
   526    526   ** But the allowed values are "grainy".  Not every value is representable.
   527    527   ** For example, quantities 16 and 17 are both represented by a LogEst
   528         -** of 40.  However, since LogEst quantatites are suppose to be estimates,
          528  +** of 40.  However, since LogEst quantaties are suppose to be estimates,
   529    529   ** not exact values, this imprecision is not a problem.
   530    530   **
   531         -** "LogEst" is short for "Logarithimic Estimate".
          531  +** "LogEst" is short for "Logarithmic Estimate".
   532    532   **
   533    533   ** Examples:
   534    534   **      1 -> 0              20 -> 43          10000 -> 132
   535    535   **      2 -> 10             25 -> 46          25000 -> 146
   536    536   **      3 -> 16            100 -> 66        1000000 -> 199
   537    537   **      4 -> 20           1000 -> 99        1048576 -> 200
   538    538   **     10 -> 33           1024 -> 100    4294967296 -> 320

Changes to src/util.c.

  1242   1242       if( b>a+49 ) return b;
  1243   1243       if( b>a+31 ) return b+1;
  1244   1244       return b+x[b-a];
  1245   1245     }
  1246   1246   }
  1247   1247   
  1248   1248   /*
  1249         -** Convert an integer into a LogEst.  In other words, compute a
  1250         -** good approximatation for 10*log2(x).
         1249  +** Convert an integer into a LogEst.  In other words, compute an
         1250  +** approximation for 10*log2(x).
  1251   1251   */
  1252   1252   LogEst sqlite3LogEst(u64 x){
  1253   1253     static LogEst a[] = { 0, 2, 3, 5, 6, 7, 8, 9 };
  1254   1254     LogEst y = 40;
  1255   1255     if( x<8 ){
  1256   1256       if( x<2 ) return 0;
  1257   1257       while( x<8 ){  y -= 10; x <<= 1; }