diff options
author | drh <> | 2024-06-11 18:22:48 +0000 |
---|---|---|
committer | drh <> | 2024-06-11 18:22:48 +0000 |
commit | ddc62664bfb5e3237b20098b30e4a99815c322e0 (patch) | |
tree | e9e1c34c0bc14a857be7fd70a26cc7d14c3b7673 /src/select.c | |
parent | b4f41b801ad0127c4f388882896c9d3ebdeb4321 (diff) | |
download | sqlite-ddc62664bfb5e3237b20098b30e4a99815c322e0.tar.gz sqlite-ddc62664bfb5e3237b20098b30e4a99815c322e0.zip |
Provide the ability to disable the exists-to-join optimization using
SQLITE_TESTCTRL_OPTIMIZATIONS. Provide tree-trace output for the optimization.
FossilOrigin-Name: 33a3f327855b427ae6ba0057218d043a1417bc9d780728f47f23acdd836e1686
Diffstat (limited to 'src/select.c')
-rw-r--r-- | src/select.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/select.c b/src/select.c index 69a07528f..e546a664c 100644 --- a/src/select.c +++ b/src/select.c @@ -7421,7 +7421,14 @@ static void existsToJoin(Parse *pParse, Select *p, Expr *pWhere){ pSub->pWhere = 0; pSub->pSrc = 0; - sqlite3SelectDelete(pParse->db, pSub); + sqlite3ParserAddCleanup(pParse, sqlite3SelectDeleteGeneric, pSub); +#if TREETRACE_ENABLED + if( sqlite3TreeTrace & 0x100000 ){ + TREETRACE(0x100000,pParse,p, + ("After EXISTS-to-JOIN optimization:\n")); + sqlite3TreeViewSelect(0, p, 0); + } +#endif } } } @@ -7756,7 +7763,7 @@ int sqlite3Select( /* If there may be an "EXISTS (SELECT ...)" in the WHERE clause, attempt ** to change it into a join. */ - if( pParse->bHasExists ){ + if( pParse->bHasExists && OptimizationEnabled(db,SQLITE_ExistsToJoin) ){ existsToJoin(pParse, p, p->pWhere); pTabList = p->pSrc; } |