diff options
author | drh <> | 2025-07-08 19:53:36 +0000 |
---|---|---|
committer | drh <> | 2025-07-08 19:53:36 +0000 |
commit | 9a13a21223bdfc123dfd537c999822ff3077cfa8 (patch) | |
tree | 51b5ecfae9ceb57f879fb478574d5589765897be /src/sqliteInt.h | |
parent | 9b91aac83b3db7a108ed203ee43b40e2e735ac0e (diff) | |
parent | 449b34571e9022333eb0cd0ce403a4636719194d (diff) | |
download | sqlite-9a13a21223bdfc123dfd537c999822ff3077cfa8.tar.gz sqlite-9a13a21223bdfc123dfd537c999822ff3077cfa8.zip |
New optimizations to detect early when queries return no rows due to
tables being empty. This includes the EXISTS-to-JOIN optimization that
tries to transform EXISTS constraints into additional terms of the FROM
clause.
FossilOrigin-Name: e33da6d5dc964db817d1bc63c9083aecd93d49ee14d5198600b47eaf7c5b9331
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r-- | src/sqliteInt.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h index a05cf75ad..7b914d958 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1154,6 +1154,7 @@ extern u32 sqlite3TreeTrace; ** 0x00040000 SELECT tree dump after all code has been generated ** 0x00080000 NOT NULL strength reduction ** 0x00100000 Pointers are all shown as zero +** 0x00200000 EXISTS-to-JOIN optimization */ /* @@ -1926,6 +1927,7 @@ struct sqlite3 { #define SQLITE_OnePass 0x08000000 /* Single-pass DELETE and UPDATE */ #define SQLITE_OrderBySubq 0x10000000 /* ORDER BY in subquery helps outer */ #define SQLITE_StarQuery 0x20000000 /* Heurists for star queries */ +#define SQLITE_ExistsToJoin 0x40000000 /* The EXISTS-to-JOIN optimization */ #define SQLITE_AllOpts 0xffffffff /* All optimizations */ /* @@ -3369,6 +3371,7 @@ struct SrcItem { unsigned rowidUsed :1; /* The ROWID of this table is referenced */ unsigned fixedSchema :1; /* Uses u4.pSchema, not u4.zDatabase */ unsigned hadSchema :1; /* Had u4.zDatabase before u4.pSchema */ + unsigned fromExists :1; /* Comes from WHERE EXISTS(...) */ } fg; int iCursor; /* The VDBE cursor number used to access this table */ Bitmask colUsed; /* Bit N set if column N used. Details above for N>62 */ @@ -3899,6 +3902,7 @@ struct Parse { u8 disableLookaside; /* Number of times lookaside has been disabled */ u8 prepFlags; /* SQLITE_PREPARE_* flags */ u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */ + u8 bHasExists; /* Has a correlated "EXISTS (SELECT ....)" expression */ u8 mSubrtnSig; /* mini Bloom filter on available SubrtnSig.selId */ u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */ u8 bReturning; /* Coding a RETURNING trigger */ |