summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2010-03-04 15:38:38 (GMT)
committerkh1 <qt-info@nokia.com>2010-03-04 15:44:17 (GMT)
commitf2ff0521dfae47f63c9334cbc78b4070aa9c9d7d (patch)
treea3de315087e7e39f4c809c0ccd71ced0a2498c38 /tools
parent2a41fe19491e8ca28f8a8b4415dd9575c3608f46 (diff)
downloadQt-f2ff0521dfae47f63c9334cbc78b4070aa9c9d7d.zip
Qt-f2ff0521dfae47f63c9334cbc78b4070aa9c9d7d.tar.gz
Qt-f2ff0521dfae47f63c9334cbc78b4070aa9c9d7d.tar.bz2
Set database write behavior to synchronous=OFF and increase page cache.
This improves the INSERT performance dramatically, since we won't wait anymore until all data is written back to the database. Should not have any impact on the database consistency in case of an app crash, only in case the whole OS crashes, but then you might be in trouble anyway. Reviewed-by: ck
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/lib/qhelpcollectionhandler.cpp8
-rw-r--r--tools/assistant/lib/qhelpgenerator.cpp3
2 files changed, 11 insertions, 0 deletions
diff --git a/tools/assistant/lib/qhelpcollectionhandler.cpp b/tools/assistant/lib/qhelpcollectionhandler.cpp
index 235f737..bd8dc20 100644
--- a/tools/assistant/lib/qhelpcollectionhandler.cpp
+++ b/tools/assistant/lib/qhelpcollectionhandler.cpp
@@ -114,6 +114,9 @@ bool QHelpCollectionHandler::openCollectionFile()
return false;
}
+ m_query.exec(QLatin1String("PRAGMA synchronous=OFF"));
+ m_query.exec(QLatin1String("PRAGMA cache_size=3000"));
+
m_query.exec(QLatin1String("SELECT COUNT(*) FROM sqlite_master WHERE TYPE=\'table\'"
"AND Name=\'NamespaceTable\'"));
m_query.next();
@@ -163,6 +166,9 @@ bool QHelpCollectionHandler::copyCollectionFile(const QString &fileName)
return false;
}
+ copyQuery->exec(QLatin1String("PRAGMA synchronous=OFF"));
+ copyQuery->exec(QLatin1String("PRAGMA cache_size=3000"));
+
if (!createTables(copyQuery)) {
emit error(tr("Cannot copy collection file: %1").arg(colFile));
return false;
@@ -582,6 +588,8 @@ void QHelpCollectionHandler::optimizeDatabase(const QString &fileName)
}
QSqlQuery query(db);
+ db.exec(QLatin1String("PRAGMA synchronous=OFF"));
+ db.exec(QLatin1String("PRAGMA cache_size=3000"));
db.exec(QLatin1String("CREATE INDEX IF NOT EXISTS NameIndex ON IndexTable(Name)"));
db.exec(QLatin1String("CREATE INDEX IF NOT EXISTS FileNameIndex ON FileNameTable(Name)"));
db.exec(QLatin1String("CREATE INDEX IF NOT EXISTS FileIdIndex ON FileNameTable(FileId)"));
diff --git a/tools/assistant/lib/qhelpgenerator.cpp b/tools/assistant/lib/qhelpgenerator.cpp
index 783f016..85bdd75 100644
--- a/tools/assistant/lib/qhelpgenerator.cpp
+++ b/tools/assistant/lib/qhelpgenerator.cpp
@@ -191,6 +191,9 @@ bool QHelpGenerator::generate(QHelpDataInterface *helpData,
return false;
}
+ d->query->exec(QLatin1String("PRAGMA synchronous=OFF"));
+ d->query->exec(QLatin1String("PRAGMA cache_size=3000"));
+
addProgress(1.0);
createTables();
insertFileNotFoundFile();