Restore additional ORDER BY optimizations that where broken by the

recent ORDER BY fix.

FossilOrigin-Name: c77ee6e20d3a8c91a8bf4c9063c36a95c70e17cf
This commit is contained in:
drh 2013-03-27 16:42:21 +00:00
parent 2b6c874b13
commit e6a8bbbb62
3 changed files with 12 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Improved\soptimization\sof\sORDER\sBY.
D 2013-03-27T16:05:30.603
C Restore\sadditional\sORDER\sBY\soptimizations\sthat\swhere\sbroken\sby\sthe\nrecent\sORDER\sBY\sfix.
D 2013-03-27T16:42:21.685
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in df3e48659d80e1b7765785d8d66c86b320f72cc7
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -252,7 +252,7 @@ F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83
F src/wal.c f5c7b5027d0ed0e9bc9afeb4a3a8dfea762ec7d2
F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6
F src/walker.c 3d75ba73de15e0f8cd0737643badbeb0e002f07b
F src/where.c fc912c1d321f765840b2cf63a903cf795c871386
F src/where.c 8179f4c891d2742ff7c00237b2f7b534c826503c
F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
@ -1041,7 +1041,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 488089e615e375c01b31544f06e801af950ae3db
R 7011d42dba6b11445611fd2df04727aa
P 97e5c70f2f19a1bca70dd2221b757b9e5418fce0
R 4ded79a01068c5e1c5e1e2eba18cd5f5
U drh
Z 55f146dee0dda61d0272032f415b56a9
Z 80c245e483b26492a6a00ec636bab1bb

View File

@ -1 +1 @@
97e5c70f2f19a1bca70dd2221b757b9e5418fce0
c77ee6e20d3a8c91a8bf4c9063c36a95c70e17cf

View File

@ -2927,8 +2927,9 @@ static int isSortingIndex(
nPriorSat = 0;
outerObUnique = 1;
}else{
u32 wsFlags = p->aLevel[p->i-1].plan.wsFlags;
nPriorSat = p->aLevel[p->i-1].plan.nOBSat;
if( (p->aLevel[p->i-1].plan.wsFlags & WHERE_ORDERED)==0 ){
if( (wsFlags & WHERE_ORDERED)==0 ){
/* This loop cannot be ordered unless the next outer loop is
** also ordered */
return nPriorSat;
@ -2938,7 +2939,9 @@ static int isSortingIndex(
** optimization is disabled */
return nPriorSat;
}
outerObUnique = (p->aLevel[p->i-1].plan.wsFlags & WHERE_OB_UNIQUE)!=0;
testcase( wsFlags & WHERE_OB_UNIQUE );
testcase( wsFlags & WHERE_ALL_UNIQUE );
outerObUnique = (wsFlags & (WHERE_OB_UNIQUE|WHERE_ALL_UNIQUE))!=0;
}
pOrderBy = p->pOrderBy;
assert( pOrderBy!=0 );