Minor fixes.

FossilOrigin-Name: ed5afebc410e3d430e2428d35f027bffb218e5f11036a42f97b080153e89016e
This commit is contained in:
drh
2024-02-19 23:58:26 +00:00
parent a1507a3fa0
commit ae71fa5d59
3 changed files with 10 additions and 9 deletions
+3 -2
View File
@@ -2569,6 +2569,7 @@ void sqlite3Pragma(
sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);
sqlite3VdbeAddOp2(v, OP_Rewind, iTabCur,
sqlite3VdbeCurrentAddr(v)+2+(opMask&1));
VdbeCoverage(v);
}
zSubSql = sqlite3MPrintf(db, "ANALYZE \"%w\".\"%w\"",
db->aDb[iDb].zDbSName, pTab->zName);
@@ -2587,10 +2588,10 @@ void sqlite3Pragma(
/* In a schema with a large number of tables and indexes, scale back
** the analysis_limit to avoid excess run-time in the worst case.
*/
if( !db->mallocFailed && nBtree>100 ){
if( !db->mallocFailed && nLimit>0 && nBtree>100 ){
int iAddr, iEnd;
VdbeOp *aOp;
int nLimit = 100*SQLITE_DEFAULT_OPTIMIZE_LIMIT/nBtree;
nLimit = 100*nLimit/nBtree;
if( nLimit<100 ) nLimit = 100;
aOp = sqlite3VdbeGetOp(v, 0);
iEnd = sqlite3VdbeCurrentAddr(v);