diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pragma.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pragma.c b/src/pragma.c index 40a31846b..9bb971ed7 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -2446,6 +2446,7 @@ void sqlite3Pragma( char *zSubSql; /* SQL statement for the OP_SqlExec opcode */ u32 opMask; /* Mask of operations to perform */ int nLimit; /* Analysis limit to use */ + int once = 0; /* One-time initialization done */ #ifndef SQLITE_DEFAULT_OPTIMIZE_LIMIT # define SQLITE_DEFAULT_OPTIMIZE_LIMIT 400 @@ -2488,6 +2489,12 @@ void sqlite3Pragma( continue; } + /* Hold a write transaction open for efficiency */ + if( !once ){ + sqlite3BeginWriteOperation(pParse, 0, iDb); + once = 1; + } + /* Reanalyze if the table is 25 times larger than the last analysis */ szThreshold = pTab->nRowLogEst; for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ |