From be4faac084e2676ea227037455a42c0d0b2423e2 Mon Sep 17 00:00:00 2001 From: Slawomir Bochenski Date: Tue, 14 Jun 2011 09:09:00 +0200 Subject: [PATCH] obexd: Optimise call history queries This changes order of graph pattern elements, moving OPTIONAL block to the end of the query. This gives a dramatic performance improvement. --- obexd/plugins/phonebook-tracker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obexd/plugins/phonebook-tracker.c b/obexd/plugins/phonebook-tracker.c index 1022d3a32..80dfc0214 100644 --- a/obexd/plugins/phonebook-tracker.c +++ b/obexd/plugins/phonebook-tracker.c @@ -161,6 +161,7 @@ "?_call a nmo:Call . " \ "?_unb_contact a nco:Contact . " \ "?_unb_contact nco:hasPhoneNumber ?_cpn . " \ +CONSTRAINT \ "OPTIONAL { " \ "{ SELECT ?_contact ?_cpn ?_role ?_number " \ "count(?_contact) as ?cnt " \ @@ -177,7 +178,6 @@ "} GROUP BY ?_cpn } " \ "FILTER(?cnt = 1) " \ "} " \ -CONSTRAINT \ "} " #define CALLS_LIST(CONSTRAINT) \ -- 2.47.3