Adjust the query planner to be more aggressive about using co-routines rather
than materializing subqueries and views. Implementation of enhancement request [73ebbb3a3d1a7bd3]. FossilOrigin-Name: 0b58d1b354a0f91bafeafee102acedd4654dc420afdf4eb4aaac9bf5bcb63c1f
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
C Rename\sthe\snew\speek/pokeF32()\sand\speek/pokeF64()\sto\speek/poke32f()\sand\speek/poke64f()\sfor\sconsistency\swith\srelated\sAPIs\sand\sbecause\sthey're\seasier\son\sboth\sthe\seyes\sand\sthe\sfingers.
|
||||
D 2022-12-14T18:06:01.859
|
||||
C Adjust\sthe\squery\splanner\sto\sbe\smore\saggressive\sabout\susing\sco-routines\srather\nthan\smaterializing\ssubqueries\sand\sviews.\s\sImplementation\sof\senhancement\nrequest\s[73ebbb3a3d1a7bd3].
|
||||
D 2022-12-14T18:34:05.073
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@@ -645,12 +645,12 @@ F src/printf.c e99ee9741e79ae3873458146f59644276657340385ade4e76a5f5d1c25793764
|
||||
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
||||
F src/resolve.c efea4e5fbecfd6d0a9071b0be0d952620991673391b6ffaaf4c277b0bb674633
|
||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||
F src/select.c 3b72630ae4f00a96abd5be49be67457d49b35eb8c9d97e4d4f05525f320c9d72
|
||||
F src/select.c 505b265ec68da42e40498b35d57c9937481c94065e91b151a27501cd3ab4d65e
|
||||
F src/shell.c.in 8d9dc02dd03f8fc93f3e3cdb17d8d16e8ddb985dddad213985c08186900a3ebb
|
||||
F src/sqlite.h.in e752f82b9d71f1d42b259b1900e4b1caf0965e844d756cd5cc91cc2cf45ed925
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h c4b9fa7a7e2bcdf850cfeb4b8a91d5ec47b7a00033bc996fd2ee96cbf2741f5f
|
||||
F src/sqliteInt.h 0c93dfce0ee43fa3d0391f453b956b8f222f416a16d7dc275d6f9607ee7f7bdc
|
||||
F src/sqliteInt.h 58dac6ab1352193715dc7de71cf900cafce6c3064a7331dc8b2029a6165a2b92
|
||||
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
|
||||
F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749
|
||||
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
||||
@@ -712,7 +712,7 @@ F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
|
||||
F src/tokenize.c 1305797eab3542a0896b552c6e7669c972c1468e11e92b370533c1f37a37082b
|
||||
F src/treeview.c 29b1dc7e0f84ba090734febe27393d4719682af0cae1b902d5ebf0236ecebea4
|
||||
F src/trigger.c 5e68b790f022b8dafbfb0eb244786512a95c9575fc198719d2557d73e5795858
|
||||
F src/update.c 5b0302c47cf31b533d5dff04c497ca1d8b9d89c39727e633fbe7b882fd5ac5aa
|
||||
F src/update.c f118e51768d2c1309e3c81e9f91141b22b8a1339cbc5969b1b2d810feaa25b22
|
||||
F src/upsert.c 5303dc6c518fa7d4b280ec65170f465c7a70b7ac2b22491598f6d0b4875b3145
|
||||
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
|
||||
F src/util.c 313f3154e2b85a447326f5dd15de8d31a4df6ab0c3579bd58f426ff634ec9050
|
||||
@@ -732,7 +732,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
|
||||
F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d
|
||||
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
|
||||
F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
|
||||
F src/where.c 3ee4050e453dfd03da4a8e4b5561d20b20b2302ec9d02437fb62c6f29bb78401
|
||||
F src/where.c 1425edc179cce7db5e7e9626b01716fed8498cc1f63875e96905d515e5e90bec
|
||||
F src/whereInt.h e25203e5bfee149f5f1225ae0166cfb4f1e65490c998a024249e98bb0647377c
|
||||
F src/wherecode.c 76bca3379219880d2527493b71a3be49e696f75396d3481e4de5d4ceec7886b2
|
||||
F src/whereexpr.c 05295b44b54eea76d1ba766f0908928d0e20e990c249344c9521454d3d09c7ae
|
||||
@@ -991,7 +991,7 @@ F test/enc.test 9a7be5479da985381d740b15f432800f65e2c87029ee57a318f42cb2eb43763a
|
||||
F test/enc2.test 848bf05f15b011719f478dddb7b5e9aea35e39e457493cba4c4eef75d849a5ec
|
||||
F test/enc3.test 55ef64416d72975c66167310a51dc9fc544ba3ae4858b8d5ab22f4cb6500b087
|
||||
F test/enc4.test c8f1ce3618508fd0909945beb8b8831feef2c020
|
||||
F test/eqp.test 473aea9599b4b7af46614b55198cd78167e4eccd48e60812a40db47c5c41dea9
|
||||
F test/eqp.test f3f7548d2f3df03e2f23ecaf35c7c2cc7b89848bd7c3606d94a010521b7ea4f6
|
||||
F test/errmsg.test eae9f091eb39ce7e20305de45d8e5d115b68fa856fba4ea6757b6ca3705ff7f9
|
||||
F test/eval.test 73969a2d43a511bf44080c44485a8c4d796b6a4f038d19e491867081155692c0
|
||||
F test/exclusive.test 7ff63be7503990921838d5c9f77f6e33e68e48ed1a9d48cd28745bf650bf0747
|
||||
@@ -1942,10 +1942,10 @@ F test/windowfault.test 15094c1529424e62f798bc679e3fe9dfab6e8ba2f7dfe8c923b6248c
|
||||
F test/windowpushd.test d8895d08870b7226f7693665bd292eb177e62ca06799184957b3ca7dc03067df
|
||||
F test/with1.test 9ad67fdeb2bbd808a5763c9060e214ea232f9b18d846ea3a59756dc38bdc3880
|
||||
F test/with2.test a1df41b987198383b9b70bf5e5fda390582e46398653858dbc6ceb24253b28df
|
||||
F test/with3.test 1e2e8d5e7b1d955342d0d18c250aaaa6e6bcf36ef2a818477bd01cb74f9a5d66
|
||||
F test/with3.test e7bf809bf75c1f44f98bca78bc331dbf542002c5227bf53c1261144db4e824c8
|
||||
F test/with4.test 257be66c0c67fee1defbbac0f685c3465e2cad037f21ce65f23f86084f198205
|
||||
F test/with5.test 6248213c41fab36290b5b73aa3f937309dfba337004d9d8434c3fabc8c7d4be8
|
||||
F test/with6.test c18592592b5a1c5802fd4e933d506f7b34ebbe8fdd585229793e960ae58d433f
|
||||
F test/with6.test ae570b31bf1f6fab6210fb1caf6dfa9a6d69c0e6633beb905583bb158a5e309e
|
||||
F test/withM.test 693b61765f2b387b5e3e24a4536e2e82de15ff64
|
||||
F test/without_rowid1.test a5210b8770dc4736bca4e74bc96588f43025ad03ad6a80f885afd36d9890e217
|
||||
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
|
||||
@@ -2067,8 +2067,9 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 27655c9353620aa58105e87d1e171d1f0a637deedde41c081824078385cd49ac
|
||||
R a567118b898d801a2127e71e8c79f2ca
|
||||
U stephan
|
||||
Z 94add712f164182717dce5d63a8f281f
|
||||
P cc86f03ed698a071cd02ef3dfaba69092226bff20c917d662f808061627ad285 ea278438b72e85d217e72c836cbefd68bd8b336baf33507b2d8d12ef436424cd
|
||||
R f0518c03c003c2b05726a7b1f40c0f28
|
||||
T +closed ea278438b72e85d217e72c836cbefd68bd8b336baf33507b2d8d12ef436424cd
|
||||
U drh
|
||||
Z cc759078265143195883414f41af1748
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
cc86f03ed698a071cd02ef3dfaba69092226bff20c917d662f808061627ad285
|
||||
0b58d1b354a0f91bafeafee102acedd4654dc420afdf4eb4aaac9bf5bcb63c1f
|
||||
+70
-31
@@ -6731,19 +6731,24 @@ static void havingToWhere(Parse *pParse, Select *p){
|
||||
}
|
||||
|
||||
/*
|
||||
** Check to see if the pThis entry of pTabList is a self-join of a prior view.
|
||||
** If it is, then return the SrcItem for the prior view. If it is not,
|
||||
** then return 0.
|
||||
** Check to see if the pThis entry of pTabList is a self-join of another view.
|
||||
** Search FROM-clause entries in the range of iFirst..iEnd, including iFirst
|
||||
** but stopping before iEnd.
|
||||
**
|
||||
** If pThis is a self-join, then return the SrcItem for the first other
|
||||
** instance of that view found. If pThis is not a self-join then return 0.
|
||||
*/
|
||||
static SrcItem *isSelfJoinView(
|
||||
SrcList *pTabList, /* Search for self-joins in this FROM clause */
|
||||
SrcItem *pThis /* Search for prior reference to this subquery */
|
||||
SrcItem *pThis, /* Search for prior reference to this subquery */
|
||||
int iFirst, int iEnd /* Range of FROM-clause entries to search. */
|
||||
){
|
||||
SrcItem *pItem;
|
||||
assert( pThis->pSelect!=0 );
|
||||
if( pThis->pSelect->selFlags & SF_PushDown ) return 0;
|
||||
for(pItem = pTabList->a; pItem<pThis; pItem++){
|
||||
while( iFirst<iEnd ){
|
||||
Select *pS1;
|
||||
pItem = &pTabList->a[iFirst++];
|
||||
if( pItem->pSelect==0 ) continue;
|
||||
if( pItem->fg.viaCoroutine ) continue;
|
||||
if( pItem->zName==0 ) continue;
|
||||
@@ -6888,6 +6893,62 @@ static int sameSrcAlias(SrcItem *p0, SrcList *pSrc){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return TRUE (non-zero) if the i-th entry in the pTabList SrcList can
|
||||
** be implemented as a co-routine. The i-th entry is guaranteed to be
|
||||
** a subquery.
|
||||
**
|
||||
** The subquery is implemented as a co-routine if all of the following are
|
||||
** true:
|
||||
**
|
||||
** (1) The subquery will likely be implemented in the outer loop of
|
||||
** the query. This will be the case if any one of the following
|
||||
** conditions hold:
|
||||
** (a) The subquery is the only term in the FROM clause
|
||||
** (b) The subquery is the left-most term and a CROSS JOIN or similar
|
||||
** requires it to be the outer loop
|
||||
** (c) All of the following are true:
|
||||
** (i) The subquery is the left-most subquery in the FROM clause
|
||||
** (ii) There is nothing that would prevent the subquery from
|
||||
** being used as the outer loop if the sqlite3WhereBegin()
|
||||
** routine nominates it to that position.
|
||||
** (iii) The query is not a UPDATE ... FROM
|
||||
** (2) The subquery is not a CTE that should be materialized because of
|
||||
** the AS MATERIALIZED keywords
|
||||
** (3) The subquery is not part of a left operand for a RIGHT JOIN
|
||||
** (4) The SQLITE_Coroutine optimization disable flag is not set
|
||||
** (5) The subquery is not self-joined
|
||||
*/
|
||||
static int fromClauseTermCanBeCoroutine(
|
||||
Parse *pParse, /* Parsing context */
|
||||
SrcList *pTabList, /* FROM clause */
|
||||
int i, /* Which term of the FROM clause holds the subquery */
|
||||
int selFlags /* Flags on the SELECT statement */
|
||||
){
|
||||
SrcItem *pItem = &pTabList->a[i];
|
||||
if( pItem->fg.isCte && pItem->u2.pCteUse->eM10d==M10d_Yes ) return 0;/* (2) */
|
||||
if( pTabList->a[0].fg.jointype & JT_LTORJ ) return 0; /* (3) */
|
||||
if( OptimizationDisabled(pParse->db, SQLITE_Coroutines) ) return 0; /* (4) */
|
||||
if( isSelfJoinView(pTabList, pItem, i+1, pTabList->nSrc)!=0 ){
|
||||
return 0; /* (5) */
|
||||
}
|
||||
if( i==0 ){
|
||||
if( pTabList->nSrc==1 ) return 1; /* (1a) */
|
||||
if( pTabList->a[1].fg.jointype & JT_CROSS ) return 1; /* (1b) */
|
||||
if( selFlags & SF_UpdateFrom ) return 0; /* (1c-iii) */
|
||||
return 1;
|
||||
}
|
||||
if( selFlags & SF_UpdateFrom ) return 0; /* (1c-iii) */
|
||||
while( 1 /*exit-by-break*/ ){
|
||||
if( pItem->fg.jointype & (JT_OUTER|JT_CROSS) ) return 0; /* (1c-ii) */
|
||||
if( i==0 ) break;
|
||||
i--;
|
||||
pItem--;
|
||||
if( pItem->pSelect!=0 ) return 0; /* (1c-i) */
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
** Generate code for the SELECT statement given in the p argument.
|
||||
**
|
||||
@@ -7275,35 +7336,19 @@ int sqlite3Select(
|
||||
pParse->zAuthContext = pItem->zName;
|
||||
|
||||
/* Generate code to implement the subquery
|
||||
**
|
||||
** The subquery is implemented as a co-routine if all of the following are
|
||||
** true:
|
||||
**
|
||||
** (1) the subquery is guaranteed to be the outer loop (so that
|
||||
** it does not need to be computed more than once), and
|
||||
** (2) the subquery is not a CTE that should be materialized
|
||||
** (3) the subquery is not part of a left operand for a RIGHT JOIN
|
||||
*/
|
||||
if( i==0
|
||||
&& (pTabList->nSrc==1
|
||||
|| (pTabList->a[1].fg.jointype&(JT_OUTER|JT_CROSS))!=0) /* (1) */
|
||||
&& (pItem->fg.isCte==0 || pItem->u2.pCteUse->eM10d!=M10d_Yes) /* (2) */
|
||||
&& (pTabList->a[0].fg.jointype & JT_LTORJ)==0 /* (3) */
|
||||
){
|
||||
if( fromClauseTermCanBeCoroutine(pParse, pTabList, i, p->selFlags) ){
|
||||
/* Implement a co-routine that will return a single row of the result
|
||||
** set on each invocation.
|
||||
*/
|
||||
int addrTop = sqlite3VdbeCurrentAddr(v)+1;
|
||||
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
|
||||
int addrExplain;
|
||||
#endif
|
||||
|
||||
pItem->regReturn = ++pParse->nMem;
|
||||
sqlite3VdbeAddOp3(v, OP_InitCoroutine, pItem->regReturn, 0, addrTop);
|
||||
VdbeComment((v, "%!S", pItem));
|
||||
pItem->addrFillSub = addrTop;
|
||||
sqlite3SelectDestInit(&dest, SRT_Coroutine, pItem->regReturn);
|
||||
ExplainQueryPlan2(addrExplain, (pParse, 1, "CO-ROUTINE %!S", pItem));
|
||||
ExplainQueryPlan((pParse, 1, "CO-ROUTINE %!S", pItem));
|
||||
sqlite3Select(pParse, pSub, &dest);
|
||||
pItem->pTab->nRowLogEst = pSub->nSelectRow;
|
||||
pItem->fg.viaCoroutine = 1;
|
||||
@@ -7311,10 +7356,6 @@ int sqlite3Select(
|
||||
sqlite3VdbeEndCoroutine(v, pItem->regReturn);
|
||||
sqlite3VdbeJumpHere(v, addrTop-1);
|
||||
sqlite3ClearTempRegCache(pParse);
|
||||
/* For SQLITE_SCANSTAT_NCYCLE, all instructions from the
|
||||
** OP_InitCoroutine coded above until this point are attributed to
|
||||
** the CO-ROUTINE query element. */
|
||||
sqlite3VdbeScanStatusRange(v, addrExplain, addrExplain-1, -1);
|
||||
}else if( pItem->fg.isCte && pItem->u2.pCteUse->addrM9e>0 ){
|
||||
/* This is a CTE for which materialization code has already been
|
||||
** generated. Invoke the subroutine to compute the materialization,
|
||||
@@ -7327,7 +7368,7 @@ int sqlite3Select(
|
||||
VdbeComment((v, "%!S", pItem));
|
||||
}
|
||||
pSub->nSelectRow = pCteUse->nRowEst;
|
||||
}else if( (pPrior = isSelfJoinView(pTabList, pItem))!=0 ){
|
||||
}else if( (pPrior = isSelfJoinView(pTabList, pItem, 0, i))!=0 ){
|
||||
/* This view has already been materialized by a prior entry in
|
||||
** this same FROM clause. Reuse it. */
|
||||
if( pPrior->addrFillSub ){
|
||||
@@ -7366,6 +7407,7 @@ int sqlite3Select(
|
||||
if( onceAddr ) sqlite3VdbeJumpHere(v, onceAddr);
|
||||
sqlite3VdbeAddOp2(v, OP_Return, pItem->regReturn, topAddr+1);
|
||||
VdbeComment((v, "end %!S", pItem));
|
||||
sqlite3VdbeScanStatusRange(v, addrExplain, addrExplain, -1);
|
||||
sqlite3VdbeJumpHere(v, topAddr);
|
||||
sqlite3ClearTempRegCache(pParse);
|
||||
if( pItem->fg.isCte && pItem->fg.isCorrelated==0 ){
|
||||
@@ -7375,9 +7417,6 @@ int sqlite3Select(
|
||||
pCteUse->iCur = pItem->iCursor;
|
||||
pCteUse->nRowEst = pSub->nSelectRow;
|
||||
}
|
||||
/* For SQLITE_SCANSTAT_NCYCLE, all instructions from the
|
||||
** OP_Explain to here are attibuted to the MATERIALIZE element. */
|
||||
sqlite3VdbeScanStatusRange(v, addrExplain, addrExplain, -1);
|
||||
}
|
||||
if( db->mallocFailed ) goto select_end;
|
||||
pParse->nHeight -= sqlite3SelectExprHeight(p);
|
||||
|
||||
@@ -1844,6 +1844,7 @@ struct sqlite3 {
|
||||
#define SQLITE_FlttnUnionAll 0x00800000 /* Disable the UNION ALL flattener */
|
||||
/* TH3 expects this value ^^^^^^^^^^ See flatten04.test */
|
||||
#define SQLITE_IndexedExpr 0x01000000 /* Pull exprs from index when able */
|
||||
#define SQLITE_Coroutines 0x02000000 /* Co-routines for subqueries */
|
||||
#define SQLITE_AllOpts 0xffffffff /* All optimizations */
|
||||
|
||||
/*
|
||||
@@ -3465,6 +3466,7 @@ struct Select {
|
||||
#define SF_MultiPart 0x2000000 /* Has multiple incompatible PARTITIONs */
|
||||
#define SF_CopyCte 0x4000000 /* SELECT statement is a copy of a CTE */
|
||||
#define SF_OrderByReqd 0x8000000 /* The ORDER BY clause may not be omitted */
|
||||
#define SF_UpdateFrom 0x10000000 /* Query originates with UPDATE FROM */
|
||||
|
||||
/* True if S exists and has SF_NestedFrom */
|
||||
#define IsNestedFrom(S) ((S)!=0 && ((S)->selFlags&SF_NestedFrom)!=0)
|
||||
|
||||
+2
-1
@@ -263,7 +263,8 @@ static void updateFromSelect(
|
||||
}
|
||||
}
|
||||
pSelect = sqlite3SelectNew(pParse, pList,
|
||||
pSrc, pWhere2, pGrp, 0, pOrderBy2, SF_UFSrcCheck|SF_IncludeHidden, pLimit2
|
||||
pSrc, pWhere2, pGrp, 0, pOrderBy2,
|
||||
SF_UFSrcCheck|SF_IncludeHidden|SF_UpdateFrom, pLimit2
|
||||
);
|
||||
if( pSelect ) pSelect->selFlags |= SF_OrderByReqd;
|
||||
sqlite3SelectDestInit(&dest, eDest, iEph);
|
||||
|
||||
+12
-6
@@ -836,7 +836,8 @@ static void explainAutomaticIndex(
|
||||
const char *zSep = "";
|
||||
char *zText = 0;
|
||||
int ii = 0;
|
||||
zText = sqlite3_mprintf("CREATE AUTOMATIC INDEX ON %s(", pTab->zName);
|
||||
sqlite3_str *pStr = sqlite3_str_new(pParse->db);
|
||||
sqlite3_str_appendf(pStr,"CREATE AUTOMATIC INDEX ON %s(", pTab->zName);
|
||||
assert( pIdx->nColumn>1 );
|
||||
assert( pIdx->aiColumn[pIdx->nColumn-1]==XN_ROWID );
|
||||
for(ii=0; ii<(pIdx->nColumn-1); ii++){
|
||||
@@ -844,13 +845,18 @@ static void explainAutomaticIndex(
|
||||
int iCol = pIdx->aiColumn[ii];
|
||||
|
||||
zName = pTab->aCol[iCol].zCnName;
|
||||
zText = sqlite3_mprintf("%z%s%s", zText, zSep, zName);
|
||||
sqlite3_str_appendf(pStr, "%s%s", zSep, zName);
|
||||
zSep = ", ";
|
||||
}
|
||||
*pAddrExplain = sqlite3VdbeExplain(
|
||||
pParse, 0, "%s)%s", zText, (bPartial ? " WHERE <expr>" : "")
|
||||
);
|
||||
sqlite3_free(zText);
|
||||
zText = sqlite3_str_finish(pStr);
|
||||
if( zText==0 ){
|
||||
sqlite3OomFault(pParse->db);
|
||||
}else{
|
||||
*pAddrExplain = sqlite3VdbeExplain(
|
||||
pParse, 0, "%s)%s", zText, (bPartial ? " WHERE <expr>" : "")
|
||||
);
|
||||
sqlite3_free(zText);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
+9
-9
@@ -94,7 +94,7 @@ do_eqp_test 1.7.1 {
|
||||
SELECT * FROM t3 JOIN (SELECT 1)
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE (subquery-xxxxxx)
|
||||
|--CO-ROUTINE (subquery-xxxxxx)
|
||||
| `--SCAN CONSTANT ROW
|
||||
|--SCAN (subquery-xxxxxx)
|
||||
`--SCAN t3
|
||||
@@ -103,7 +103,7 @@ do_eqp_test 1.7.2 {
|
||||
SELECT * FROM t3 JOIN (SELECT 1) AS v1
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE v1
|
||||
|--CO-ROUTINE v1
|
||||
| `--SCAN CONSTANT ROW
|
||||
|--SCAN v1
|
||||
`--SCAN t3
|
||||
@@ -112,7 +112,7 @@ do_eqp_test 1.7.3 {
|
||||
SELECT * FROM t3 AS xx JOIN (SELECT 1) AS yy
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE yy
|
||||
|--CO-ROUTINE yy
|
||||
| `--SCAN CONSTANT ROW
|
||||
|--SCAN yy
|
||||
`--SCAN xx
|
||||
@@ -123,7 +123,7 @@ do_eqp_test 1.8 {
|
||||
SELECT * FROM t3 JOIN (SELECT 1 UNION SELECT 2)
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE (subquery-xxxxxx)
|
||||
|--CO-ROUTINE (subquery-xxxxxx)
|
||||
| `--COMPOUND QUERY
|
||||
| |--LEFT-MOST SUBQUERY
|
||||
| | `--SCAN CONSTANT ROW
|
||||
@@ -136,7 +136,7 @@ do_eqp_test 1.9 {
|
||||
SELECT * FROM t3 JOIN (SELECT 1 EXCEPT SELECT a FROM t3 LIMIT 17) AS abc
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE abc
|
||||
|--CO-ROUTINE abc
|
||||
| `--COMPOUND QUERY
|
||||
| |--LEFT-MOST SUBQUERY
|
||||
| | `--SCAN CONSTANT ROW
|
||||
@@ -149,7 +149,7 @@ do_eqp_test 1.10 {
|
||||
SELECT * FROM t3 JOIN (SELECT 1 INTERSECT SELECT a FROM t3 LIMIT 17) AS abc
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE abc
|
||||
|--CO-ROUTINE abc
|
||||
| `--COMPOUND QUERY
|
||||
| |--LEFT-MOST SUBQUERY
|
||||
| | `--SCAN CONSTANT ROW
|
||||
@@ -163,7 +163,7 @@ do_eqp_test 1.11 {
|
||||
SELECT * FROM t3 JOIN (SELECT 1 UNION ALL SELECT a FROM t3 LIMIT 17) abc
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE abc
|
||||
|--CO-ROUTINE abc
|
||||
| `--COMPOUND QUERY
|
||||
| |--LEFT-MOST SUBQUERY
|
||||
| | `--SCAN CONSTANT ROW
|
||||
@@ -295,7 +295,7 @@ det 3.2.2 {
|
||||
ORDER BY x2.y LIMIT 5
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE x1
|
||||
|--CO-ROUTINE x1
|
||||
| |--SCAN t1
|
||||
| `--USE TEMP B-TREE FOR ORDER BY
|
||||
|--MATERIALIZE x2
|
||||
@@ -834,7 +834,7 @@ do_eqp_test 9.1 {
|
||||
ORDER BY 1;
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE thread
|
||||
|--CO-ROUTINE thread
|
||||
| |--SCAN x USING INDEX forumthread
|
||||
| |--USING ROWID SEARCH ON TABLE private FOR IN-OPERATOR
|
||||
| |--CORRELATED SCALAR SUBQUERY xxxxxx
|
||||
|
||||
+3
-3
@@ -89,7 +89,7 @@ ifcapable analyze {
|
||||
SELECT * FROM cnt, y1 WHERE i=a
|
||||
} [string map {"\n " \n} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE cnt
|
||||
|--CO-ROUTINE cnt
|
||||
| |--SETUP
|
||||
| | `--SCAN CONSTANT ROW
|
||||
| `--RECURSIVE STEP
|
||||
@@ -103,7 +103,7 @@ ifcapable analyze {
|
||||
SELECT * FROM cnt, y1 WHERE i=a
|
||||
} [string map {"\n " \n} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE cnt
|
||||
|--CO-ROUTINE cnt
|
||||
| |--SETUP
|
||||
| | `--SCAN CONSTANT ROW
|
||||
| `--RECURSIVE STEP
|
||||
@@ -125,7 +125,7 @@ do_eqp_test 3.2.2 {
|
||||
WHERE c.id=w2.pk AND c.id=w1.pk;
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE c
|
||||
|--CO-ROUTINE c
|
||||
| |--SETUP
|
||||
| | |--SCAN CONSTANT ROW
|
||||
| | `--SCALAR SUBQUERY xxxxxx
|
||||
|
||||
+4
-4
@@ -87,7 +87,7 @@ do_eqp_test 131 {
|
||||
(SELECT x FROM c LIMIT 5) AS c3;
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE c1
|
||||
|--CO-ROUTINE c1
|
||||
| |--CO-ROUTINE c
|
||||
| | `--SCAN 2 CONSTANT ROWS
|
||||
| `--SCAN c
|
||||
@@ -123,7 +123,7 @@ do_eqp_test 141 {
|
||||
(SELECT x FROM c LIMIT 7) AS c3;
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE c1
|
||||
|--CO-ROUTINE c1
|
||||
| |--MATERIALIZE c
|
||||
| | `--SCAN 2 CONSTANT ROWS
|
||||
| `--SCAN c
|
||||
@@ -151,7 +151,7 @@ do_eqp_test 151 {
|
||||
(SELECT x FROM c LIMIT 7) AS c3;
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE c1
|
||||
|--CO-ROUTINE c1
|
||||
| |--MATERIALIZE c
|
||||
| | `--SCAN 2 CONSTANT ROWS
|
||||
| `--SCAN c
|
||||
@@ -228,7 +228,7 @@ do_eqp_test 211 {
|
||||
SELECT y FROM t2 ORDER BY y;
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--MATERIALIZE c1
|
||||
|--CO-ROUTINE c1
|
||||
| |--CO-ROUTINE c
|
||||
| | `--SCAN 3 CONSTANT ROWS
|
||||
| `--SCAN c
|
||||
|
||||
Reference in New Issue
Block a user