-C Fix\stable-valued\sfunctions\sso\sthat\sthey\swill\swork\sas\sthe\sright\stable\nin\sa\sLEFT\sJOIN.\s\sTicket\s[2ae0c599b735d59e]
-D 2024-04-02T18:31:48.544
+C Fix\stypos\sin\scomments.\s\sProvided\s".wheretrace"\sdebugging\soutput\sfor\sthe\ninterstage\sheuristic\smodule.\s\sDo\somit\sautomatic\sindex\sloops\sin\sthe\ninterstage\sheuristic.
+D 2024-04-02T18:48:25.553
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F src/wal.c 9eccc7ebb532a7b0fd3cabc16cff576b9afa763472272db67d84fb8cec96f5c0
F src/wal.h 606292549f5a7be50b6227bd685fa76e3a4affad71bb8ac5ce4cb5c79f6a176a
F src/walker.c 7607f1a68130c028255d8d56094ea602fc402c79e1e35a46e6282849d90d5fe4
-F src/where.c 9c4a3b64e633941b5dc4e3020f3b53fd2430374dde4d32547c6402b57eeff7d6
+F src/where.c 88042f93c5955c628ee77ff9b1ff675527c92ff5efbc7dbd63c01ae45c2e5069
F src/whereInt.h 064a1508edcc9af400a3b79211ba55e553fab6451b797a31334c0d11cbb7debb
F src/wherecode.c cf67460973119c7b2141ad67daf8368dfb4871f225e2489f95effaa139007bfd
F src/whereexpr.c 9813b81c1bb5c9e90c093d3be7b842fec49072ef6b53c454756aa986735d1d36
F test/whereJ.test 88287550f6ee604422403b053455b1ad894eeaa5c35d348532dfa1439286cb9a
F test/whereK.test f8e3cf26a8513ecc7f514f54df9f0572c046c42b
F test/whereL.test 0a19fc44cd1122040f56c934f1b14d0ca85bde28f270268a428dd9796ea0634c
-F test/whereN.test 63a3584b71acfb6963416de82f26c6b1644abc5ca6080c76546b9246734c8803
+F test/whereN.test d205fe91148c4bfc50b668ce9f8ebcaafd4ad806447d5bfee8c482d4cd98545c
F test/wherefault.test 1374c3aa198388925246475f84ad4cd5f9528864
F test/wherelfault.test 9012e4ef5259058b771606616bd007af5d154e64cc25fa9fd4170f6411db44e3
F test/wherelimit.test 592081800806d297dd7449b1030c863d2883d6d42901837ccd2e5a9bd962edb0
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 74b247d958d74782302546dcce8c8d8fba021b7f3d801ef6823225fb3213065f
-Q +2c35d3f67b67a53ead08b1c395e7ca8e5bf65f94a5a962a0562994a3c66c95d9
-R 15c8cc18c8d04cd7d5868c63d03458ec
+P 1f97086d628b6f52e6f9a87cd9d2c365f3c51f5b33c5c36a3f83889ec08765be
+Q +186dcae19e249db36de15f295999cff25063b54ee3d5d481cd2ba99b6d13148e
+R 72348ce53a15ea8deb2d0622361d010b
U drh
-Z 1d3e014b02d3781f05c16bb73c514800
+Z 298c3dc9319a58678b6aa3cd002b5e96
# Remove this line to create a well-formed Fossil manifest.
-1f97086d628b6f52e6f9a87cd9d2c365f3c51f5b33c5c36a3f83889ec08765be
\ No newline at end of file
+357d9513d2bd13c4e9f227300d43a04d13ae1d34b0b5ec55e8b94eb3204d1921
\ No newline at end of file
** Except, if the first solver() call generated a full-table scan in an outer
** loop then stop this analysis at the first full-scan, since the second
** solver() run might try to swap that full-scan for another in order to
-** get the output into the correct order. In other words, we do *not* want
-** to inhibit a rewrites like this:
+** get the output into the correct order. In other words, we allow a
+** rewrite like this:
**
** First Solver() Second Solver()
** |-- SCAN t1 |-- SCAN t2
** |-- SEARCH t2 `-- SEARCH t1
** `-- SORT USING B-TREE
**
-** Rather, the purpose of this routine is to inhibit rewrites such as:
+** The purpose of this routine is to disallow rewrites such as:
**
** First Solver() Second Solver()
** |-- SEARCH t1 |-- SCAN t2 <--- bad!
*/
static SQLITE_NOINLINE void whereInterstageHeuristic(WhereInfo *pWInfo){
int i;
+#ifdef WHERETRACE_ENABLED
+ int once = 0;
+#endif
for(i=0; i<pWInfo->nLevel; i++){
WhereLoop *p = pWInfo->a[i].pWLoop;
if( p==0 ) break;
WhereLoop *pLoop;
for(pLoop=pWInfo->pLoops; pLoop; pLoop=pLoop->pNextLoop){
if( pLoop->iTab!=iTab ) continue;
- if( (pLoop->wsFlags & WHERE_CONSTRAINT)!=0 ) continue;
+ if( (pLoop->wsFlags & (WHERE_CONSTRAINT|WHERE_AUTO_INDEX))!=0 ){
+ /* Auto-index and index-constrained loops allowed to remain */
+ continue;
+ }
+#ifdef WHERETRACE_ENABLED
+ if( sqlite3WhereTrace & 0x80 ){
+ if( once==0 ){
+ sqlite3DebugPrintf("Loops disabled by interstage heuristic:\n");
+ once = 1;
+ }
+ whereLoopPrint(pLoop, &pWInfo->sWC);
+ }
+#endif /* WHERETRACE_ENABLED */
pLoop->prereq = ALLBITS; /* Prevent 2nd solver() from using this one */
}
}else{
('violation','v1','376661 28974 1'),
('rule','rule2','24 12 1'),
('datasource','ds1','3 1 1');
- ANALYZE sqlite_schema;
+ ANALYZE sqlite_master;
}
set DSNAME ds-two ;# Only a few rows. Change to "ds-one" for many rows.
do_eqp_test 1.1 {
);
} {
QUERY PLAN
- |--CO-ROUTINE (subquery-xxxxxx)
- | |--SEARCH DS USING COVERING INDEX ds1 (name=?)
- | |--SEARCH R USING COVERING INDEX rule2 (dsid=?)
- | |--SEARCH V USING INDEX v1 (rid=?)
+ |--CO-ROUTINE xxxxxx
+ | |--SEARCH TABLE datasource AS DS USING COVERING INDEX ds1 (name=?)
+ | |--SEARCH TABLE rule AS R USING COVERING INDEX rule2 (dsid=?)
+ | |--SEARCH TABLE violation AS V USING INDEX v1 (rid=?)
| `--USE TEMP B-TREE FOR ORDER BY
- `--SCAN (subquery-xxxxxx)
+ `--SCAN SUBQUERY xxxxxx
}
# ^^^^---- We want to see three SEARCH terms. No SCAN terms.
# The ORDER BY is implemented by a separate sorter pass.