diff options
author | drh <> | 2023-06-20 17:45:19 +0000 |
---|---|---|
committer | drh <> | 2023-06-20 17:45:19 +0000 |
commit | 40ee72947e39f54e9acc4d6ad7f024b87509652b (patch) | |
tree | 606f3d9d2e7fc7334e38b96a5cd59f115057efe0 /src | |
parent | c439b9e0c6f5551abc1c8fb82368e4b9f0d3836f (diff) | |
download | sqlite-40ee72947e39f54e9acc4d6ad7f024b87509652b.tar.gz sqlite-40ee72947e39f54e9acc4d6ad7f024b87509652b.zip |
Omit unnecessary calls to table locking routines in the common case when
there is no shared cache.
FossilOrigin-Name: f94f3021cde1d46373ee8fc8e5028d7507a937240c59cf0d0d19ab22acbd3c41
Diffstat (limited to 'src')
-rw-r--r-- | src/build.c | 6 | ||||
-rw-r--r-- | src/insert.c | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/build.c b/src/build.c index 51a26326e..fe3a781d6 100644 --- a/src/build.c +++ b/src/build.c @@ -234,15 +234,17 @@ void sqlite3FinishCoding(Parse *pParse){ pParse->nVtabLock = 0; #endif +#ifndef SQLITE_OMIT_SHARED_CACHE /* Once all the cookies have been verified and transactions opened, ** obtain the required table-locks. This is a no-op unless the ** shared-cache feature is enabled. */ - codeTableLocks(pParse); + if( pParse->nTableLock ) codeTableLocks(pParse); +#endif /* Initialize any AUTOINCREMENT data structures required. */ - sqlite3AutoincrementBegin(pParse); + if( pParse->pAinc ) sqlite3AutoincrementBegin(pParse); /* Code constant expressions that where factored out of inner loops. ** diff --git a/src/insert.c b/src/insert.c index 58840bf4c..1c31ca233 100644 --- a/src/insert.c +++ b/src/insert.c @@ -35,8 +35,10 @@ void sqlite3OpenTable( assert( pParse->pVdbe!=0 ); v = pParse->pVdbe; assert( opcode==OP_OpenWrite || opcode==OP_OpenRead ); - sqlite3TableLock(pParse, iDb, pTab->tnum, - (opcode==OP_OpenWrite)?1:0, pTab->zName); + if( !pParse->db->noSharedCache ){ + sqlite3TableLock(pParse, iDb, pTab->tnum, + (opcode==OP_OpenWrite)?1:0, pTab->zName); + } if( HasRowid(pTab) ){ sqlite3VdbeAddOp4Int(v, opcode, iCur, pTab->tnum, iDb, pTab->nNVCol); VdbeComment((v, "%s", pTab->zName)); @@ -2675,7 +2677,7 @@ int sqlite3OpenTableAndIndices( *piDataCur = iDataCur; if( HasRowid(pTab) && (aToOpen==0 || aToOpen[0]) ){ sqlite3OpenTable(pParse, iDataCur, iDb, pTab, op); - }else{ + }else if( pParse->db->noSharedCache==0 ){ sqlite3TableLock(pParse, iDb, pTab->tnum, op==OP_OpenWrite, pTab->zName); } *piIdxCur = iBase; |