]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
When the query planner has the opportunity to use an IN operater constraint
authordrh <drh@noemail.net>
Fri, 8 Jun 2018 23:23:53 +0000 (23:23 +0000)
committerdrh <drh@noemail.net>
Fri, 8 Jun 2018 23:23:53 +0000 (23:23 +0000)
on a term of an index other than the left-most term, use the estimated number
of elements on the right-hand side of the IN operator to determine if makes
sense to use the IN operator with index looks, or to just do a scan over the
range of the table identified by the index terms to the left.   Only do this
if sqlite_stat1 measurements are available as otherwise the performance
estimates will not be accurate enough to discern the best plan.  Bias the
decision slightly in favor of using index lookups on each element of the IN
operator.

FossilOrigin-Name: 2cbbabdf5ef624d809fbb40d2d312a29e0b5f02756fc0dbf6985fc8b0c8d1ade

1  2 
manifest
manifest.uuid

diff --cc manifest
index c8299d9c0de19376eef956a0d7abf0140f6f1d55,bb077b21539b0e2991e5daf5e035efdb78d8be9e..61b07880e08bf3bacd232552d6d6515ba8b556a0
+++ b/manifest
@@@ -1,5 -1,5 +1,5 @@@
- C Fix\san\sassert()\sthat\scan\sbe\sfalse\sfor\sa\scorrupt\sdatabase\sand\sa\sstrange\squery\nthat\suses\sa\srecursive\sSQL\sfunction\sto\sdelete\scontent\sfrom\sa\scorrupt\sdatabase\nfile\swhile\sit\sis\sbeing\squeried.
- D 2018-06-08T19:13:57.914
 -C Only\schoose\sto\sscan\san\sIN\soperator\srather\sthan\suse\san\sindex\sif\swe\shave\nreal\sSTAT1\sdata\sto\ssuggest\sit\sis\sadvantageous.
 -D 2018-06-08T21:21:01.417
++C When\sthe\squery\splanner\shas\sthe\sopportunity\sto\suse\san\sIN\soperater\sconstraint\non\sa\sterm\sof\san\sindex\sother\sthan\sthe\sleft-most\sterm,\suse\sthe\sestimated\snumber\nof\selements\son\sthe\sright-hand\sside\sof\sthe\sIN\soperator\sto\sdetermine\sif\smakes\nsense\sto\suse\sthe\sIN\soperator\swith\sindex\slooks,\sor\sto\sjust\sdo\sa\sscan\sover\sthe\nrange\sof\sthe\stable\sidentified\sby\sthe\sindex\sterms\sto\sthe\sleft.\s\s\sOnly\sdo\sthis\nif\ssqlite_stat1\smeasurements\sare\savailable\sas\sotherwise\sthe\sperformance\nestimates\swill\snot\sbe\saccurate\senough\sto\sdiscern\sthe\sbest\splan.\s\sBias\sthe\ndecision\sslightly\sin\sfavor\sof\susing\sindex\slookups\son\seach\selement\sof\sthe\sIN\noperator.
++D 2018-06-08T23:23:53.721
  F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
  F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
  F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da
@@@ -1731,7 -1731,7 +1731,8 @@@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a9
  F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
  F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
  F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
- P 09fffbdf9f2f6ce31a22d5a6df7a45f19a16628da622f12d6e33171cce09fb21
- R e90ea8c0bc9f17fa862de55346ad01f3
 -P 11bd66e09035039fbfc4c5631196962dd3f2e6634f5123a7b2fec17aeaaab07b
++P 99057383acc8f92093530e216c621d40386a06fe98131ff0af6df524d80a6410 30e874661dcc1a2ecb40df2ef74582151d85bb36c754a38548829a3b6285f18d
+ R 54c7353f86aece043f7640340784a722
++T +closed 30e874661dcc1a2ecb40df2ef74582151d85bb36c754a38548829a3b6285f18d
  U drh
- Z dc7dec1a328a3fd8e94df605e9d025f7
 -Z b0c1273ce7490f506712c4b76e5917fd
++Z 3947665ab12ebd8b4ea54e65ad1b9691
diff --cc manifest.uuid
index 715434fba37fe25b95dbf98daf50d07296b76cb2,764612de10b23255f2c77cbae73a70ab0508e2a1..49cd303dadcbcaa39836c8a291977a425c5ce717
@@@ -1,1 -1,1 +1,1 @@@
- 99057383acc8f92093530e216c621d40386a06fe98131ff0af6df524d80a6410
 -30e874661dcc1a2ecb40df2ef74582151d85bb36c754a38548829a3b6285f18d
++2cbbabdf5ef624d809fbb40d2d312a29e0b5f02756fc0dbf6985fc8b0c8d1ade