SQLite

Check-in [fd7cd06093]
Login

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

Overview
Comment:Adjust the cost estimates for RTREE such that the expected number of rows and expected cost is halved for each additional constraint.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | xbestindex-fix
Files: files | file ages | folders
SHA1: fd7cd0609381a85673d1f737ebeb19dde3de180f
User & Date: drh 2016-03-05 20:28:24.332
Context
2016-03-05
21:07
Change the way SQLite invokes the xBestIndex method of virtual tables so that N-way joins involving virtual tables work as expected. (check-in: 195444380b user: dan tags: trunk)
20:28
Adjust the cost estimates for RTREE such that the expected number of rows and expected cost is halved for each additional constraint. (Closed-Leaf check-in: fd7cd06093 user: drh tags: xbestindex-fix)
17:29
Change the way SQLite invokes the xBestIndex method of virtual tables so that N-way joins involving virtual tables work as expected. (check-in: ffc65968ed user: dan tags: xbestindex-fix)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/rtree/rtree.c.
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751

  pIdxInfo->idxNum = 2;
  pIdxInfo->needToFreeIdxStr = 1;
  if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){
    return SQLITE_NOMEM;
  }

  nRow = pRtree->nRowEst / (iIdx + 1);
  pIdxInfo->estimatedCost = (double)6.0 * (double)nRow;
  setEstimatedRows(pIdxInfo, nRow);

  return rc;
}

/*







|







1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751

  pIdxInfo->idxNum = 2;
  pIdxInfo->needToFreeIdxStr = 1;
  if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){
    return SQLITE_NOMEM;
  }

  nRow = pRtree->nRowEst >> (iIdx/2);
  pIdxInfo->estimatedCost = (double)6.0 * (double)nRow;
  setEstimatedRows(pIdxInfo, nRow);

  return rc;
}

/*