]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Do not use the [/info/609fbb94b8f01d67|viewscan optimization] on a query
authordrh <>
Tue, 18 Jul 2023 21:06:19 +0000 (21:06 +0000)
committerdrh <>
Tue, 18 Jul 2023 21:06:19 +0000 (21:06 +0000)
that has only a single loop, as the cost adjustments can cause problems
for outer queries.  Proposed fix for the performance regression reported by
[forum:/forumpost/64d36440e473516c|forum post 64d36440e473516c].

FossilOrigin-Name: 76152ad2ffe56034f2fd93d9a1ce9358e1677a7e9cd3dcd9f3a34a5c956a463e

manifest
manifest.uuid
src/where.c

index 2333353d42163b7a53d22a2e2e58df09c7932af8..e1145c527fddd1c01f8dbac360c55b4e118a4aca 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improved\s".wheretrace"\sfor\sthe\sVIEWSCAN\soptimization.
-D 2023-07-18T20:41:09.317
+C Do\snot\suse\sthe\s[/info/609fbb94b8f01d67|viewscan\soptimization]\son\sa\squery\nthat\shas\sonly\sa\ssingle\sloop,\sas\sthe\scost\sadjustments\scan\scause\sproblems\nfor\souter\squeries.\s\sProposed\sfix\sfor\sthe\sperformance\sregression\sreported\sby\n[forum:/forumpost/64d36440e473516c|forum\spost\s64d36440e473516c].
+D 2023-07-18T21:06:19.893
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -722,7 +722,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
 F src/wal.c dd843f619ac60d5dadab7109cf402432ba74dde0c301505fd1c202add07659e3
 F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
 F src/walker.c 7c7ea0115345851c3da4e04e2e239a29983b61fb5b038b94eede6aba462640e2
-F src/where.c e551d13d4aff9176690368ae1b3acff10ede1f451652c75e9dfc9bb2d85d5970
+F src/where.c 477fcc5e561ef169e6002499602af6b805156c2aae6b2f5c2c93ef8c1cd64768
 F src/whereInt.h c7d19902863beadec1d04e66aca39c0bcd60b74f05f0eaa7422c7005dfc5d51a
 F src/wherecode.c 5d77db30a2a3dd532492ae882de114edba2fae672622056b1c7fd61f5917a8f1
 F src/whereexpr.c dc5096eca5ed503999be3bdee8a90c51361289a678d396a220912e9cb73b3c00
@@ -2043,8 +2043,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 4dcad2db743fdb9ef72871ca5a4d1384f76cb697161b0f5110e2670a83a18e8a
-R 226cc4c3c153723bae524ae831eeb8ad
+P 27057ea76b5f72c73fb6f16094736685019643c665b49fd0bb8d60a812ce2338
+R e083cfeae9842a7650b26a959bcc57e4
 U drh
-Z 09fb8db5361f1b823e48611e4afd0f28
+Z 4c6375f8dd8261298072fd9d19053ffb
 # Remove this line to create a well-formed Fossil manifest.
index f9b2c165b47d13d2beced5dbc10375e39b6707e4..24332574c1c8a8e21fbfad7af5b1f827b010a39d 100644 (file)
@@ -1 +1 @@
-27057ea76b5f72c73fb6f16094736685019643c665b49fd0bb8d60a812ce2338
\ No newline at end of file
+76152ad2ffe56034f2fd93d9a1ce9358e1677a7e9cd3dcd9f3a34a5c956a463e
\ No newline at end of file
index 923a4d77c700531e180626f2e56665d532708441..35b9056ffe72282059bcecd5d3a9127b1811ed75 100644 (file)
@@ -5122,7 +5122,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
 
         /* TUNING:  A full-scan of a VIEW or subquery in the outer loop
         ** is not so bad. */
-        if( iLoop==0 && (pWLoop->wsFlags & WHERE_VIEWSCAN)!=0 ){
+        if( iLoop==0 && (pWLoop->wsFlags & WHERE_VIEWSCAN)!=0 && nLoop>1 ){
           rCost += -10;
           nOut += -30;
           WHERETRACE(0x80,("VIEWSCAN cost reduction for %c\n",pWLoop->cId));