summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-28 12:23:35 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-28 12:23:35 +0100
commitdb81ad9d9fb04ef161351cabd79bca228a1ff78e (patch)
tree6eef8a48406011a5fbc9588132c9fae969640fe5
parent4dadbdebf53e72a70dabb91677b18d3d300dacc2 (diff)
db: Begin with some indexes to speed up look-ups
For MT-SMS we need to look-up a subscriber based on the extension and to find a undelivered SMS we need to search for the sent column to be NULL. Add two indexes to speed-up this operation.
-rw-r--r--openbsc/src/libmsc/db.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c
index 0999071ad..990aa7b0e 100644
--- a/openbsc/src/libmsc/db.c
+++ b/openbsc/src/libmsc/db.c
@@ -61,6 +61,8 @@ enum {
SCHEMA_RATE,
SCHEMA_AUTHKEY,
SCHEMA_AUTHLAST,
+ IDX_SUBSCRIBER_EXTENSION,
+ IDX_SMS_SENT,
};
static const char *create_stmts[] = {
@@ -174,6 +176,10 @@ static const char *create_stmts[] = {
"sres BLOB NOT NULL, "
"kc BLOB NOT NULL "
")",
+ [IDX_SUBSCRIBER_EXTENSION] = "CREATE INDEX IF NOT EXISTS "
+ "subscriber_ext ON Subscriber(extension)",
+ [IDX_SMS_SENT] = "CREATE INDEX IF NOT EXISTS "
+ "sms_sent ON SMS(sent)",
};
void db_error_func(dbi_conn conn, void *data)