summaryrefslogtreecommitdiff
path: root/tools/assistant/lib/qhelpcollectionhandler.cpp
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2010-03-04 16:38:38 +0100
committerkh1 <qt-info@nokia.com>2010-03-04 16:44:17 +0100
commitf2ff0521dfae47f63c9334cbc78b4070aa9c9d7d (patch)
treea3de315087e7e39f4c809c0ccd71ced0a2498c38 /tools/assistant/lib/qhelpcollectionhandler.cpp
parent2a41fe19491e8ca28f8a8b4415dd9575c3608f46 (diff)
downloadqt4-tools-f2ff0521dfae47f63c9334cbc78b4070aa9c9d7d.tar.gz
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/assistant/lib/qhelpcollectionhandler.cpp')
-rw-r--r--tools/assistant/lib/qhelpcollectionhandler.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/assistant/lib/qhelpcollectionhandler.cpp b/tools/assistant/lib/qhelpcollectionhandler.cpp
index 235f737bc6..bd8dc20375 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)"));