diff options
author | drh <> | 2025-06-30 21:07:08 +0000 |
---|---|---|
committer | drh <> | 2025-06-30 21:07:08 +0000 |
commit | 3d21dcc924fb1049c7e0cbc42a21ebfe17d472b6 (patch) | |
tree | dc966f98234fe3d2f383309cb7b8a257d3edbf97 /src | |
parent | ba56f7020d5829aa9b4b9a7556ca23785fa771f4 (diff) | |
download | sqlite-3d21dcc924fb1049c7e0cbc42a21ebfe17d472b6.tar.gz sqlite-3d21dcc924fb1049c7e0cbc42a21ebfe17d472b6.zip |
More aggressive optimization of addrHalt for RIGHT JOIN.
FossilOrigin-Name: 5e51d1c0dfcafef9e71c99de3f626dee157c935724b84c6e0c630299a880446f
Diffstat (limited to 'src')
-rw-r--r-- | src/where.c | 3 | ||||
-rw-r--r-- | src/wherecode.c | 11 |
2 files changed, 2 insertions, 12 deletions
diff --git a/src/where.c b/src/where.c index 824cfcd8c..ddf3f7499 100644 --- a/src/where.c +++ b/src/where.c @@ -7078,6 +7078,8 @@ WhereInfo *sqlite3WhereBegin( pLevel->addrBrk = sqlite3VdbeMakeLabel(pParse); if( ii==0 || (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){ pLevel->addrHalt = pLevel->addrBrk; + }else if( pWInfo->a[ii-1].pRJ ){ + pLevel->addrHalt = pWInfo->a[ii-1].addrBrk; }else{ pLevel->addrHalt = pWInfo->a[ii-1].addrHalt; } @@ -7211,7 +7213,6 @@ WhereInfo *sqlite3WhereBegin( && (pLevel->pRJ = sqlite3WhereMalloc(pWInfo, sizeof(WhereRightJoin)))!=0 ){ WhereRightJoin *pRJ = pLevel->pRJ; - pLevel->addrHalt = pLevel->addrBrk; pRJ->iMatch = pParse->nTab++; pRJ->regBloom = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_Blob, 65536, pRJ->regBloom); diff --git a/src/wherecode.c b/src/wherecode.c index c5fa7a213..cc672aa83 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -1545,17 +1545,6 @@ Bitmask sqlite3WhereCodeOneLoopStart( VdbeComment((v, "init LEFT JOIN match flag")); } -#ifdef SQLITE_DEBUG - /* Re-compute the address to jump to if we discover that the table for - ** this loop is empty and can never contribute content. Verify that the - ** computation here agrees with the one in sqlite3WhereBegin(). */ - for(j=iLevel; j>0; j--){ - if( pWInfo->a[j].iLeftJoin ) break; - if( pWInfo->a[j].pRJ ) break; - } - assert( pWInfo->a[j].addrBrk==pLevel->addrHalt ); -#endif - /* Special case of a FROM clause subquery implemented as a co-routine */ if( pTabItem->fg.viaCoroutine ){ int regYield; |