2011-06-14 07:09:00

by Slawomir Bochenski

[permalink] [raw]
Subject: [PATCH] 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.
---
plugins/phonebook-tracker.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index 1022d3a..80dfc02 100644
--- a/plugins/phonebook-tracker.c
+++ b/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) \
--
1.7.4.1



2011-06-14 09:10:10

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] Optimise call history queries

Hi Slawek,

On Tue, Jun 14, 2011, Slawomir Bochenski wrote:
> This changes order of graph pattern elements, moving OPTIONAL block to
> the end of the query. This gives a dramatic performance improvement.
> ---
> plugins/phonebook-tracker.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)

Applied. Thanks.

Johan