/ Check-in [dfbca3ac]

Overview
Comment: Must faster computation of estimated logarithm. Tarball | ZIP archive | SQL archive family | ancestors | descendants | both | files | file ages | folders dfbca3acaeb862f24f25e7810a16ff2066111ff4 drh 2013-06-07 02:04:19
Context
 2013-06-10 12:17 Add a high-speed bypass for the NGQP for the common case of a simply query with quality constraints that outputs a single row. (check-in: 8d1ba309 user: drh tags: nextgen-query-plan-exp) 2013-06-09 17:21 High-speed version of NGQP. Still has some minor problems. (check-in: db2415fa user: drh tags: nextgen-query-plan-fast) 2013-06-07 02:04 Must faster computation of estimated logarithm. (check-in: dfbca3ac user: drh tags: nextgen-query-plan-exp) 00:29 Further prepare-time performance improvements. (check-in: 02741d17 user: drh tags: nextgen-query-plan-exp)
Changes

Changes to src/where.c.

```  1827   1827   ** Prepare a crude estimate of the logarithm of the input value.
1828   1828   ** The results need not be exact.  This is only used for estimating
1829   1829   ** the total cost of performing operations with O(logN) or O(NlogN)
1830   1830   ** complexity.  Because N is just a guess, it is no great tragedy if
1831   1831   ** logN is a little off.
1832   1832   */
1833   1833   static WhereCost estLog(WhereCost N){
1834         -  WhereCost logN = 1;
1835         -  WhereCost x = 10;
1836         -  while( N>x ){
1837         -    logN += 1;
1838         -    x *= 10;
1839         -  }
1840         -  return logN;
1834  +  u32 a;
1835  +  assert( sizeof(WhereCost)==4 );  /* 32-bit float input */
1836  +  if( N<=0.0 ) return 0.0;
1837  +  memcpy(&a, &N, 4);
1838  +  return ((a >>= 23)-127)*0.3;
1841   1839   }
1842   1840
1843   1841   /*
1844   1842   ** Two routines for printing the content of an sqlite3_index_info
1845   1843   ** structure.  Used for testing and debugging only.  If neither
1846   1844   ** SQLITE_TEST or SQLITE_DEBUG are defined, then these routines
1847   1845   ** are no-ops.
................................................................................
5394   5392     if( pDistinct && isDistinctRedundant(pParse,pTabList,&pWInfo->sWC,pDistinct) ){
5395   5393       pDistinct = 0;
5396   5394       pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
5397   5395     }
5398   5396
5399   5397     /* Construct the WhereLoop objects */
5400   5398     WHERETRACE(("*** Optimizer Start ***\n"));
5399  +  /* TBD: if( nTablist==1 ) whereCommonCase(&sWLB); */