From 6068b6b451bd14462f006ea5e9134a43581660da Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 4 May 2021 16:51:52 +0000 Subject: [PATCH] Additional debugging output for whereScanNext() showing equivalence classes when the ".wheretrace" setting contains the 0x20000 bit. FossilOrigin-Name: 9280e3d994656344d4feb346156df8a278da80181f6efe0ff8e0340b6f0f91cb --- manifest | 15 +++++++-------- manifest.uuid | 2 +- src/where.c | 12 ++++++++++++ src/whereInt.h | 4 ++-- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index ec778d924b..9102843109 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Back\sout\sthe\sEXISTS-to-IN\soptimization.\s\sIt\sslows\sthings\sdown\srather\sthan\nspeeds\sthem\sup\sdepending\son\sthe\squery.\s\sAnd\s(see\n[forum:/forumpost/8692d94725|forum\spost\s8692d94725])\sit\ssometimes\sresults\sin\nan\sincorrect\sanswer.\s\sWe\smay\scome\sback\sand\srevisit\sthis\soptimization\slater,\nbut\sfor\snow\sit\sseems\sbest\sjust\sto\sdisable\sit. -D 2021-05-04T12:07:16.531 +C Additional\sdebugging\soutput\sfor\swhereScanNext()\sshowing\sequivalence\sclasses\nwhen\sthe\s".wheretrace"\ssetting\scontains\sthe\s0x20000\sbit. +D 2021-05-04T16:51:52.122 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -630,8 +630,8 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c c8ec20a1ca161d5635a4f19c2a4efec2e006e19a8a61f272bf6bce1c80ab7436 F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a F src/walker.c 6e540867a30d81e00205995fa2dc0e3d25365a7402251c9fd5d19aa4ff5e60b6 -F src/where.c 33bae7248e206b874456982a07b859acd880fb7b137678b2dc1e277c234b8b6f -F src/whereInt.h 446e5e8018f83358ef917cf32d8e6a86dc8430113d0b17e720f1839d3faa44c4 +F src/where.c 8c05e12a6bd0ea15e104d170872032a7d8ccfacb5300fe15cc237d64bed7f15d +F src/whereInt.h e2c7d2e9342a7b06410bb415c1d9de4b3930230734aa62afeca1e2c8e0c6e640 F src/wherecode.c 992bf0d7520bffd345472fb9bc83a1ca0134e46d9e904879bb21e1e77957fcc3 F src/whereexpr.c 811f339ca85540157f3a400333ba90237ffbe7a2ba82dac63ce0677f4c4109d0 F src/window.c 2e092a03ee2e7e6541dd44fa6cb4cd0abdd142fc9c9ed6bac2788daa53316e33 @@ -1912,8 +1912,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 204086a94202fc631371b75c7a8286df2f66116399628ac27ef54533641b8f20 -Q -c1862abb44873f06ec0d772469d8a2d128ae4670b1e98c2d97b0e2da18df9a04 -R f628cb24055240816ba06b9a4320261c +P 16252d73fa73569fd7506676f6ffbbcd43addfb105384fb74449d30ca720904a +R ed3e85a77b46e0c46715c64f5f0bc657 U drh -Z 02e047978739c3f696576a32fee6343b +Z 92f743b35f73493441b99d86eb148538 diff --git a/manifest.uuid b/manifest.uuid index 2df7af8290..750d58c792 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -16252d73fa73569fd7506676f6ffbbcd43addfb105384fb74449d30ca720904a \ No newline at end of file +9280e3d994656344d4feb346156df8a278da80181f6efe0ff8e0340b6f0f91cb \ No newline at end of file diff --git a/src/where.c b/src/where.c index 606e326b18..d051464abb 100644 --- a/src/where.c +++ b/src/where.c @@ -338,6 +338,18 @@ static WhereTerm *whereScanNext(WhereScan *pScan){ } pScan->pWC = pWC; pScan->k = k+1; +#ifdef WHERETRACE_ENABLED + if( sqlite3WhereTrace & 0x20000 ){ + int ii; + sqlite3DebugPrintf("SCAN-TERM %p: nEquiv=%d", + pTerm, pScan->nEquiv); + for(ii=0; iinEquiv; ii++){ + sqlite3DebugPrintf(" {%d:%d}", + pScan->aiCur[ii], pScan->aiColumn[ii]); + } + sqlite3DebugPrintf("\n"); + } +#endif return pTerm; } } diff --git a/src/whereInt.h b/src/whereInt.h index 8896da0271..0bc43bf883 100644 --- a/src/whereInt.h +++ b/src/whereInt.h @@ -293,8 +293,8 @@ struct WhereScan { const char *zCollName; /* Required collating sequence, if not NULL */ Expr *pIdxExpr; /* Search for this index expression */ char idxaff; /* Must match this affinity, if zCollName!=NULL */ - unsigned char nEquiv; /* Number of entries in aEquiv[] */ - unsigned char iEquiv; /* Next unused slot in aEquiv[] */ + unsigned char nEquiv; /* Number of entries in aiCur[] and aiColumn[] */ + unsigned char iEquiv; /* Next unused slot in aiCur[] and aiColumn[] */ u32 opMask; /* Acceptable operators */ int k; /* Resume scanning at this->pWC->a[this->k] */ int aiCur[11]; /* Cursors in the equivalence class */