Honor a high likelihood() on range constraints.

FossilOrigin-Name: 401235edf40fcd665eaf426cf5155ac6855e8537
This commit is contained in:
drh 2014-10-24 15:26:29 +00:00
parent 9769efcc4c
commit 4dd96a8315
3 changed files with 12 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Get\sthe\slikelihood()\sfunctions\sworking\son\soperators\slike\sBETWEEN\sthat\ncreate\svirtual\sterms\sin\sthe\sWHERE-clause\sanalysis.
D 2014-10-24T14:32:21.050
C Honor\sa\shigh\slikelihood()\son\srange\sconstraints.
D 2014-10-24T15:26:29.800
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -302,7 +302,7 @@ F src/vtab.c cb0c194303fea276b48d7d4b6d970b5a96bde8de
F src/wal.c 10e7de7ce90865a68153f001a61f1d985cd17983
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
F src/where.c 746d4f22d75c1f000d6dae251dc65bf755c395a8
F src/where.c f5c13d9c1929bcc9d571f1e7bf7bfeb8b872ef99
F src/whereInt.h 4b459cdbfc9b01f5f27673a35f9967e4dea917e8
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
@ -1205,7 +1205,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 9762ad0639cca2fc1ef0573113fb613ce9e7e83e
R f460b87a81ee1fb775b7700e4252ece6
P 03d0498d0f24bec2383d5d79edf25069effecd59
R eb013b99b9ff12a41d5ffc947e4a6227
U drh
Z 1428b6fe81396b49c1c6b7022fde286d
Z 3215dd92b9608b7b9136fb91eb8178e8

View File

@ -1 +1 @@
03d0498d0f24bec2383d5d79edf25069effecd59
401235edf40fcd665eaf426cf5155ac6855e8537

View File

@ -2275,12 +2275,15 @@ static int whereRangeScanEst(
nNew = whereRangeAdjust(pLower, nOut);
nNew = whereRangeAdjust(pUpper, nNew);
/* TUNING: If there is both an upper and lower limit, assume the range is
/* TUNING: If there is both an upper and lower limit and neither limit
** has an application-defined likelihood(), assume the range is
** reduced by an additional 75%. This means that, by default, an open-ended
** range query (e.g. col > ?) is assumed to match 1/4 of the rows in the
** index. While a closed range (e.g. col BETWEEN ? AND ?) is estimated to
** match 1/64 of the index. */
if( pLower && pUpper ) nNew -= 20;
if( pLower && pLower->truthProb>0 && pUpper && pUpper->truthProb>0 ){
nNew -= 20;
}
nOut -= (pLower!=0) + (pUpper!=0);
if( nNew<10 ) nNew = 10;