Commit 135560d2 authored by David Keeler's avatar David Keeler

Bug 1363569 - improve SQL queries in sdb_FindObjects* r=franziskus

Summary:
When sqlite prepares statements, it appears to have an algorithm which is
O(n * m), where n is the number of columns in the table and m is the number of
columns selected in the query. Since the certificate database has about 115
columns, when "SELECT * FROM ..." is used, it introduces significant overhead.
Since sdb_FindObjects only uses the id column of the results of the query, the
queries in sdb_FindObjectsInit can be changed to select only the id column
rather than all of them.

Reviewers: franziskus

Reviewed By: franziskus

Differential Revision: https://nss-review.dev.mozaws.net/D314

--HG--
extra : rebase_source : ed5bf33591d406b5dc062dc624a7d1bc3f018940
extra : amend_source : aa310794fb10d253f4cd24c98799969e5ff9e98c
parent ffa9d06d
......@@ -674,8 +674,8 @@ struct SDBFindStr {
sqlite3_stmt *findstmt;
};
static const char FIND_OBJECTS_CMD[] = "SELECT ALL * FROM %s WHERE %s;";
static const char FIND_OBJECTS_ALL_CMD[] = "SELECT ALL * FROM %s;";
static const char FIND_OBJECTS_CMD[] = "SELECT ALL id FROM %s WHERE %s;";
static const char FIND_OBJECTS_ALL_CMD[] = "SELECT ALL id FROM %s;";
CK_RV
sdb_FindObjectsInit(SDB *sdb, const CK_ATTRIBUTE *template, CK_ULONG count,
SDBFind **find)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment