mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Add an optimization that attempts to run a subquery as a coroutine rather
than manifesting it into a temporary table. FossilOrigin-Name: 7af3acbbd49a2114fcdada9ec907c68ba9b053bd
This commit is contained in:
18
src/vdbe.c
18
src/vdbe.c
@@ -2207,7 +2207,10 @@ case OP_Column: {
|
||||
** the number of columns is stored in the VdbeCursor.nField element.
|
||||
*/
|
||||
pC = p->apCsr[p1];
|
||||
assert( pC!=0 );
|
||||
if( pC==0 ){
|
||||
sqlite3VdbeMemSetNull(pDest);
|
||||
goto op_column_out;
|
||||
}
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
assert( pC->pVtabCursor==0 );
|
||||
#endif
|
||||
@@ -2237,6 +2240,11 @@ case OP_Column: {
|
||||
}
|
||||
}else if( ALWAYS(pC->pseudoTableReg>0) ){
|
||||
pReg = &aMem[pC->pseudoTableReg];
|
||||
if( pC->multiPseudo ){
|
||||
sqlite3VdbeMemShallowCopy(pDest, pReg+p2, MEM_Ephem);
|
||||
Deephemeralize(pDest);
|
||||
goto op_column_out;
|
||||
}
|
||||
assert( pReg->flags & MEM_Blob );
|
||||
assert( memIsValid(pReg) );
|
||||
payloadSize = pReg->n;
|
||||
@@ -3322,8 +3330,9 @@ case OP_SorterOpen: {
|
||||
**
|
||||
** Open a new cursor that points to a fake table that contains a single
|
||||
** row of data. The content of that one row in the content of memory
|
||||
** register P2. In other words, cursor P1 becomes an alias for the
|
||||
** MEM_Blob content contained in register P2.
|
||||
** register P2 when P5==0. In other words, cursor P1 becomes an alias for the
|
||||
** MEM_Blob content contained in register P2. When P5==1, then the
|
||||
** row is represented by P3 consecutive registers beginning with P2.
|
||||
**
|
||||
** A pseudo-table created by this opcode is used to hold a single
|
||||
** row output from the sorter so that the row can be decomposed into
|
||||
@@ -3343,6 +3352,7 @@ case OP_OpenPseudo: {
|
||||
pCx->pseudoTableReg = pOp->p2;
|
||||
pCx->isTable = 1;
|
||||
pCx->isIndex = 0;
|
||||
pCx->multiPseudo = pOp->p5;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4307,7 +4317,7 @@ case OP_Rowid: { /* out2-prerelease */
|
||||
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
||||
pC = p->apCsr[pOp->p1];
|
||||
assert( pC!=0 );
|
||||
assert( pC->pseudoTableReg==0 );
|
||||
assert( pC->pseudoTableReg==0 || pC->nullRow );
|
||||
if( pC->nullRow ){
|
||||
pOut->flags = MEM_Null;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user