SQLite

Check-in [dfbca3acae]
Login

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

Overview
Comment:Must faster computation of estimated logarithm.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | nextgen-query-plan-exp
Files: files | file ages | folders
SHA1: dfbca3acaeb862f24f25e7810a16ff2066111ff4
User & Date: drh 2013-06-07 02:04:19.774
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: 8d1ba30921 user: drh tags: nextgen-query-plan-exp)
2013-06-09
17:21
High-speed version of NGQP. Still has some minor problems. (check-in: db2415fa67 user: drh tags: nextgen-query-plan-fast)
2013-06-07
02:04
Must faster computation of estimated logarithm. (check-in: dfbca3acae user: drh tags: nextgen-query-plan-exp)
00:29
Further prepare-time performance improvements. (check-in: 02741d177b user: drh tags: nextgen-query-plan-exp)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/where.c.
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
** Prepare a crude estimate of the logarithm of the input value.
** The results need not be exact.  This is only used for estimating
** the total cost of performing operations with O(logN) or O(NlogN)
** complexity.  Because N is just a guess, it is no great tragedy if
** logN is a little off.
*/
static WhereCost estLog(WhereCost N){
  WhereCost logN = 1;
  WhereCost x = 10;
  while( N>x ){
    logN += 1;
    x *= 10;
  }
  return logN;
}

/*
** Two routines for printing the content of an sqlite3_index_info
** structure.  Used for testing and debugging only.  If neither
** SQLITE_TEST or SQLITE_DEBUG are defined, then these routines
** are no-ops.







|
|
|
|
<
<
|







1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837


1838
1839
1840
1841
1842
1843
1844
1845
** Prepare a crude estimate of the logarithm of the input value.
** The results need not be exact.  This is only used for estimating
** the total cost of performing operations with O(logN) or O(NlogN)
** complexity.  Because N is just a guess, it is no great tragedy if
** logN is a little off.
*/
static WhereCost estLog(WhereCost N){
  u32 a;
  assert( sizeof(WhereCost)==4 );  /* 32-bit float input */
  if( N<=0.0 ) return 0.0;
  memcpy(&a, &N, 4);


  return ((a >>= 23)-127)*0.3;
}

/*
** Two routines for printing the content of an sqlite3_index_info
** structure.  Used for testing and debugging only.  If neither
** SQLITE_TEST or SQLITE_DEBUG are defined, then these routines
** are no-ops.
5394
5395
5396
5397
5398
5399
5400

5401
5402
5403
5404
5405
5406
5407
  if( pDistinct && isDistinctRedundant(pParse,pTabList,&pWInfo->sWC,pDistinct) ){
    pDistinct = 0;
    pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
  }

  /* Construct the WhereLoop objects */
  WHERETRACE(("*** Optimizer Start ***\n"));

  rc = whereLoopAddAll(&sWLB);
  if( rc ) goto whereBeginError;

  /* Display all of the WhereLoop objects if wheretrace is enabled */
#ifdef WHERETRACE_ENABLED
  if( sqlite3WhereTrace ){
    WhereLoop *p;







>







5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
  if( pDistinct && isDistinctRedundant(pParse,pTabList,&pWInfo->sWC,pDistinct) ){
    pDistinct = 0;
    pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
  }

  /* Construct the WhereLoop objects */
  WHERETRACE(("*** Optimizer Start ***\n"));
  /* TBD: if( nTablist==1 ) whereCommonCase(&sWLB); */
  rc = whereLoopAddAll(&sWLB);
  if( rc ) goto whereBeginError;

  /* Display all of the WhereLoop objects if wheretrace is enabled */
#ifdef WHERETRACE_ENABLED
  if( sqlite3WhereTrace ){
    WhereLoop *p;