mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Do a single OP_Expire at the very end of "PRAGMA optimize", and omit the
OP_Expire on ANALYZE commands invoked by the pragma. FossilOrigin-Name: 188300a337c87b7ee0dd1f4b9a4f1bd80e70cca4
This commit is contained in:
@@ -1388,27 +1388,14 @@ void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){
|
||||
if( i==1 ) continue; /* Do not analyze the TEMP database */
|
||||
analyzeDatabase(pParse, i);
|
||||
}
|
||||
}else if( pName2->n==0 ){
|
||||
/* Form 2: Analyze the database or table named */
|
||||
iDb = sqlite3FindDb(db, pName1);
|
||||
if( iDb>=0 ){
|
||||
analyzeDatabase(pParse, iDb);
|
||||
}else{
|
||||
z = sqlite3NameFromToken(db, pName1);
|
||||
if( z ){
|
||||
if( (pIdx = sqlite3FindIndex(db, z, 0))!=0 ){
|
||||
analyzeTable(pParse, pIdx->pTable, pIdx);
|
||||
}else if( (pTab = sqlite3LocateTable(pParse, 0, z, 0))!=0 ){
|
||||
analyzeTable(pParse, pTab, 0);
|
||||
}
|
||||
sqlite3DbFree(db, z);
|
||||
}
|
||||
}
|
||||
}else if( pName2->n==0 && (iDb = sqlite3FindDb(db, pName1))>=0 ){
|
||||
/* Analyze the schema named as the argument */
|
||||
analyzeDatabase(pParse, iDb);
|
||||
}else{
|
||||
/* Form 3: Analyze the fully qualified table name */
|
||||
/* Form 3: Analyze the table or index named as an argument */
|
||||
iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pTableName);
|
||||
if( iDb>=0 ){
|
||||
zDb = db->aDb[iDb].zDbSName;
|
||||
zDb = pName2->n ? db->aDb[iDb].zDbSName : 0;
|
||||
z = sqlite3NameFromToken(db, pTableName);
|
||||
if( z ){
|
||||
if( (pIdx = sqlite3FindIndex(db, z, zDb))!=0 ){
|
||||
@@ -1418,10 +1405,11 @@ void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){
|
||||
}
|
||||
sqlite3DbFree(db, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( db->nSqlExec==0 && (v = sqlite3GetVdbe(pParse))!=0 ){
|
||||
sqlite3VdbeAddOp0(v, OP_Expire);
|
||||
}
|
||||
v = sqlite3GetVdbe(pParse);
|
||||
if( v ) sqlite3VdbeAddOp0(v, OP_Expire);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user