Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mozkeeler committed May 10, 2017
1 parent ffa9d06 commit 135560d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/softoken/sdb.c
Expand Up @@ -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)
Expand Down

0 comments on commit 135560d

Please sign in to comment.