diff options
author | drh <> | 2025-07-01 17:36:55 +0000 |
---|---|---|
committer | drh <> | 2025-07-01 17:36:55 +0000 |
commit | 5e71497404b8a03d25b324b14dafa0496dc665c7 (patch) | |
tree | a63b0a64b759ceeddfb756cb531170aef81644e6 /src | |
parent | 526399b0fde79944b81d6af74d779d0131b70721 (diff) | |
download | sqlite-5e71497404b8a03d25b324b14dafa0496dc665c7.tar.gz sqlite-5e71497404b8a03d25b324b14dafa0496dc665c7.zip |
Cache and reuse virtual table cursors in the bytecode engine.
FossilOrigin-Name: 2d187d4232d750cb1840f1d89c8aed65962cb0883c1d7f91c554b451e475c514
Diffstat (limited to 'src')
-rw-r--r-- | src/vdbe.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/vdbe.c b/src/vdbe.c index 9e696d0c3..0020b52bf 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -8269,7 +8269,14 @@ case OP_VOpen: { /* ncycle */ const sqlite3_module *pModule; assert( p->bIsReader ); - pCur = 0; + pCur = p->apCsr[pOp->p1]; + if( pCur!=0 + && ALWAYS( pCur->eCurType==CURTYPE_VTAB ) + && ALWAYS( pCur->uc.pVCur->pVtab==pOp->p4.pVtab->pVtab ) + ){ + /* This opcode is a no-op if the cursor is already open */ + break; + } pVCur = 0; pVtab = pOp->p4.pVtab->pVtab; if( pVtab==0 || NEVER(pVtab->pModule==0) ){ |