My Oracle Support Banner

SPARQL Aggregation Functions Are Slow (Doc ID 1631461.1)

Last updated on MARCH 06, 2019

Applies to:

Oracle Spatial and Graph - Version 12.1.0.1 and later
Information in this document applies to any platform.

Symptoms

SPARQL aggregation functions are slow

The following query takes 19 seconds to execute

set timing on
SELECT COUNT(*)
FROM TABLE(SEM_MATCH(
'SELECT (SAMPLE(?s) AS ?s1) (SAMPLE(?p) AS ?p1) ?o
 WHERE
 {
  ?s ?p ?o
 }
 GROUP BY ?o
 HAVING (COUNT(?s) = 1)
',
SEM_Models('test'),
NULL,
NULL,
NULL,
NULL
));

If we avoid the aggregate by using a sub-query it runs in under 2 seconds

SELECT COUNT(*)
FROM TABLE(SEM_MATCH(
'SELECT ?s ?p ?o
 WHERE
 {
  ?s ?p ?o.
  {
  SELECT ?o
  WHERE
  {
  ?s ?p ?o
  }
  GROUP BY ?o
  HAVING (COUNT(?s) = 1)
  }
 }
',
SEM_Models('test'),
NULL,
NULL,
NULL,
NULL
));

Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.