mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-24 08:21:29 +03:00
Further tweaks to the query planner logic in preparation for adding
ORDER BY opt-out for joins. FossilOrigin-Name: 53efc10af990d3f293551f3cd8ef2f8be2d9d716
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Further\srefactoring\sof\sthe\sORDER\sBY\srelated\squery-planning\slogic\sin\sorder\nto\smake\sit\seasier\sto\sextend\sto\ssupport\soptimizing\sout\sORDER\sBY\son\sjoins.\nNo\sactual\sbehavior\schanges,\syet.
|
C Further\stweaks\sto\sthe\squery\splanner\slogic\sin\spreparation\sfor\sadding\nORDER\sBY\sopt-out\sfor\sjoins.
|
||||||
D 2012-09-26T23:17:01.276
|
D 2012-09-27T12:05:09.522
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 5f4f26109f9d80829122e0e09f9cda008fa065fb
|
F Makefile.in 5f4f26109f9d80829122e0e09f9cda008fa065fb
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -249,7 +249,7 @@ F src/vtab.c d8020c0a0e8ccc490ca449d7e665311b6e9f3ba9
|
|||||||
F src/wal.c 5acb3e7bbd31f10ba39acad9ce6b399055337a9d
|
F src/wal.c 5acb3e7bbd31f10ba39acad9ce6b399055337a9d
|
||||||
F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6
|
F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6
|
||||||
F src/walker.c 3d75ba73de15e0f8cd0737643badbeb0e002f07b
|
F src/walker.c 3d75ba73de15e0f8cd0737643badbeb0e002f07b
|
||||||
F src/where.c 59b852d51d86fd3bf5935067994114bf88affbef
|
F src/where.c 67438c6192c5f777139e7abb642a9186a21a718d
|
||||||
F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823
|
F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823
|
||||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||||
F test/aggnested.test 0be144b453e0622a085fae8665c32f5676708e00
|
F test/aggnested.test 0be144b453e0622a085fae8665c32f5676708e00
|
||||||
@@ -1016,7 +1016,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||||
F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
|
F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
|
||||||
P 4226e51ff837f0ffe16355491a655d919d13488e
|
P 96496ddae12a239b30a1fc997fbea43e3a75bfe7
|
||||||
R 82e96539fb8ddcfab6615c786a34a1ea
|
R 57ad7fba1d5db0bb9191afb65acee747
|
||||||
U drh
|
U drh
|
||||||
Z e46432508017f3912d4e7cd1bd8daf63
|
Z 58fdbd300662a0c1ec2665b77df5f795
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
96496ddae12a239b30a1fc997fbea43e3a75bfe7
|
53efc10af990d3f293551f3cd8ef2f8be2d9d716
|
||||||
23
src/where.c
23
src/where.c
@@ -3067,13 +3067,8 @@ static void bestBtreeIndex(WhereBestIdx *p){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
nOrderBy = p->pOrderBy ? p->pOrderBy->nExpr : 0;
|
nOrderBy = p->pOrderBy ? p->pOrderBy->nExpr : 0;
|
||||||
if( (p->i) > 0 ){
|
bSort = nOrderBy>0 && (p->i==0 || p->aLevel[p->i-1].plan.nOBSat<nOrderBy);
|
||||||
bSort = 0;
|
bDist = p->i==0 && p->pDistinct!=0;
|
||||||
bDist = 0;
|
|
||||||
}else{
|
|
||||||
bSort = p->pOrderBy!=0;
|
|
||||||
bDist = p->pDistinct!=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Determine the values of nEq and nInMul */
|
/* Determine the values of nEq and nInMul */
|
||||||
for(nEq=nOrdered=0; nEq<pProbe->nColumn; nEq++){
|
for(nEq=nOrdered=0; nEq<pProbe->nColumn; nEq++){
|
||||||
@@ -3369,8 +3364,8 @@ static void bestBtreeIndex(WhereBestIdx *p){
|
|||||||
|
|
||||||
WHERETRACE((
|
WHERETRACE((
|
||||||
"%s(%s): nEq=%d nInMul=%d rangeDiv=%d bSort=%d bLookup=%d wsFlags=0x%x\n"
|
"%s(%s): nEq=%d nInMul=%d rangeDiv=%d bSort=%d bLookup=%d wsFlags=0x%x\n"
|
||||||
" notReady=0x%llx log10N=%.1f nRow=%.1f cost=%.1f used=0x%llx\n"
|
" notReady=0x%llx log10N=%.1f nRow=%.1f cost=%.1f\n"
|
||||||
" nOrdered=%d nOBSat=%d\n",
|
" used=0x%llx nOrdered=%d nOBSat=%d\n",
|
||||||
pSrc->pTab->zName, (pIdx ? pIdx->zName : "ipk"),
|
pSrc->pTab->zName, (pIdx ? pIdx->zName : "ipk"),
|
||||||
nEq, nInMul, (int)rangeDiv, bSort, bLookup, wsFlags,
|
nEq, nInMul, (int)rangeDiv, bSort, bLookup, wsFlags,
|
||||||
p->notReady, log10N, nRow, cost, used, nOrdered, nOBSat
|
p->notReady, log10N, nRow, cost, used, nOrdered, nOBSat
|
||||||
@@ -5024,8 +5019,9 @@ WhereInfo *sqlite3WhereBegin(
|
|||||||
&& sWBI.cost.plan.nRow<bestPlan.plan.nRow))
|
&& sWBI.cost.plan.nRow<bestPlan.plan.nRow))
|
||||||
){
|
){
|
||||||
WHERETRACE(("=== table %d is best so far"
|
WHERETRACE(("=== table %d is best so far"
|
||||||
" with cost=%g and nRow=%g\n",
|
" with cost=%.1f, nRow=%.1f, nOBSat=%d\n",
|
||||||
j, sWBI.cost.rCost, sWBI.cost.plan.nRow));
|
j, sWBI.cost.rCost, sWBI.cost.plan.nRow,
|
||||||
|
sWBI.cost.plan.nOBSat));
|
||||||
bestPlan = sWBI.cost;
|
bestPlan = sWBI.cost;
|
||||||
bestJ = j;
|
bestJ = j;
|
||||||
}
|
}
|
||||||
@@ -5035,8 +5031,9 @@ WhereInfo *sqlite3WhereBegin(
|
|||||||
assert( bestJ>=0 );
|
assert( bestJ>=0 );
|
||||||
assert( sWBI.notValid & getMask(pMaskSet, pTabList->a[bestJ].iCursor) );
|
assert( sWBI.notValid & getMask(pMaskSet, pTabList->a[bestJ].iCursor) );
|
||||||
WHERETRACE(("*** Optimizer selects table %d for loop %d"
|
WHERETRACE(("*** Optimizer selects table %d for loop %d"
|
||||||
" with cost=%g and nRow=%g\n",
|
" with cost=%.1f, nRow=%.1f, nOBSat=%d\n",
|
||||||
bestJ, pLevel-pWInfo->a, bestPlan.rCost, bestPlan.plan.nRow));
|
bestJ, pLevel-pWInfo->a, bestPlan.rCost, bestPlan.plan.nRow,
|
||||||
|
bestPlan.plan.nOBSat));
|
||||||
if( (bestPlan.plan.wsFlags & WHERE_ORDERBY)!=0 ){
|
if( (bestPlan.plan.wsFlags & WHERE_ORDERBY)!=0 ){
|
||||||
pWInfo->nOBSat = pOrderBy->nExpr;
|
pWInfo->nOBSat = pOrderBy->nExpr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user