aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sqliteInt.h1
-rw-r--r--src/where.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 731612d34..0a661937f 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -1024,6 +1024,7 @@ struct sqlite3 {
#define SQLITE_OrderByIdxJoin 0x0080 /* ORDER BY of joins via index */
#define SQLITE_SubqCoroutine 0x0100 /* Evaluate subqueries as coroutines */
#define SQLITE_Transitive 0x0200 /* Transitive constraints */
+#define SQLITE_OmitNoopJoin 0x0400 /* Omit unused tables in joins */
#define SQLITE_AllOpts 0xffff /* All optimizations */
/*
diff --git a/src/where.c b/src/where.c
index 32fa61c7f..e20f2b301 100644
--- a/src/where.c
+++ b/src/where.c
@@ -5789,7 +5789,10 @@ WhereInfo *sqlite3WhereBegin(
}
#endif
/* Attempt to omit tables from the join that do not effect the result */
- if( pResultSet!=0 && pWInfo->nLevel>=2 ){
+ if( pWInfo->nLevel>=2
+ && pResultSet!=0
+ && OptimizationEnabled(db, SQLITE_OmitNoopJoin)
+ ){
Bitmask tabUsed = exprListTableUsage(pMaskSet, pResultSet);
if( pOrderBy ) tabUsed |= exprListTableUsage(pMaskSet, pOrderBy);
while( pWInfo->nLevel>=2 ){