Improve performance of fts5 writes by writing the "averages" record once at

the end of each transaction instead of every time the table is updated.

FossilOrigin-Name: 2b210d691462b463796e7948399133c296e89ebf
This commit is contained in:
dan
2017-02-27 17:06:56 +00:00
parent 8a89d834d6
commit 81415257ec
3 changed files with 9 additions and 20 deletions
+2 -12
View File
@@ -545,11 +545,6 @@ int sqlite3Fts5StorageDelete(Fts5Storage *p, i64 iDel, sqlite3_value **apVal){
}
}
/* Write the averages record */
if( rc==SQLITE_OK ){
rc = fts5StorageSaveTotals(p);
}
return rc;
}
@@ -753,11 +748,6 @@ int sqlite3Fts5StorageIndexInsert(
}
sqlite3_free(buf.p);
/* Write the averages record */
if( rc==SQLITE_OK ){
rc = fts5StorageSaveTotals(p);
}
return rc;
}
@@ -1094,9 +1084,9 @@ int sqlite3Fts5StorageRowCount(Fts5Storage *p, i64 *pnRow){
int sqlite3Fts5StorageSync(Fts5Storage *p, int bCommit){
int rc = SQLITE_OK;
i64 iLastRowid = sqlite3_last_insert_rowid(p->pConfig->db);
if( bCommit && p->bTotalsValid ){
if( p->bTotalsValid ){
rc = fts5StorageSaveTotals(p);
p->bTotalsValid = 0;
if( bCommit ) p->bTotalsValid = 0;
}
if( rc==SQLITE_OK ){
rc = sqlite3Fts5IndexSync(p->pIndex, bCommit);