aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-06-22 15:44:26 +0000
committerdrh <drh@noemail.net>2013-06-22 15:44:26 +0000
commit1031bd99581c1c3d7da99eb1c9a74a4cf053e0da (patch)
tree104c9e5188609ab615cd9d8b5347e4bf88164e45 /src
parentbc71b1d4536ce7842f80010049c69f5fd2806b3b (diff)
downloadsqlite-1031bd99581c1c3d7da99eb1c9a74a4cf053e0da.tar.gz
sqlite-1031bd99581c1c3d7da99eb1c9a74a4cf053e0da.zip
Add the ability to disable the omit-join-table optimization for testing
purposes. FossilOrigin-Name: d929df9b1ba214c27d8c437099a53ee9b07aa169
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 ){