/ Check-in [75437bee]
Login

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

Overview
Comment:Make sure the estLog() routine in the query planner handles negative values correctly (always returning 1). Prior to this change, estLog(-1) would return a large number which could throw off the cost computations in the query planner in obscure circumstances.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 75437bee4905949c66dc7694ea234d4d5aefd981
User & Date: drh 2014-06-06 20:20:09
Context
2014-06-06
20:49
Add a test case to ensure that estLog() works for negative numbers. check-in: 813469d9 user: drh tags: trunk
20:20
Make sure the estLog() routine in the query planner handles negative values correctly (always returning 1). Prior to this change, estLog(-1) would return a large number which could throw off the cost computations in the query planner in obscure circumstances. check-in: 75437bee user: drh tags: trunk
17:09
Fix an obsolete comment on the whereRangeScanEst() routine. No changes to code. check-in: b16bf851 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  1490   1490   }
  1491   1491   
  1492   1492   
  1493   1493   /*
  1494   1494   ** Estimate the logarithm of the input value to base 2.
  1495   1495   */
  1496   1496   static LogEst estLog(LogEst N){
  1497         -  LogEst x = sqlite3LogEst(N);
         1497  +  LogEst x = N<0 ? 1 : sqlite3LogEst(N);
  1498   1498     return x>33 ? x - 33 : 0;
  1499   1499   }
  1500   1500   
  1501   1501   /*
  1502   1502   ** Two routines for printing the content of an sqlite3_index_info
  1503   1503   ** structure.  Used for testing and debugging only.  If neither
  1504   1504   ** SQLITE_TEST or SQLITE_DEBUG are defined, then these routines