[ 
https://issues.apache.org/jira/browse/MARMOTTA-575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergio Fernández resolved MARMOTTA-575.
---------------------------------------
    Resolution: Not a Problem
      Assignee: Sergio Fernández

Typically this happens on systems running for a long time with a lot of deleted 
triples.

On system not using version, the quick fix is to clean those deleted triples 
from the database with the following query: 

{code:sql}
DELETE
FROM triples
WHERE deleted = true
{code}

> SELECT queries over a free subject generated to many CROSS JOINs
> ----------------------------------------------------------------
>
>                 Key: MARMOTTA-575
>                 URL: https://issues.apache.org/jira/browse/MARMOTTA-575
>             Project: Marmotta
>          Issue Type: Improvement
>          Components: KiWi Triple Store
>    Affects Versions: 3.3.0
>            Reporter: Sergio Fernández
>            Assignee: Sergio Fernández
>              Labels: sparql
>             Fix For: 3.3.0
>
>
> In the typical usage of SPARQL retrieving all properties for a concrete type:
> {code:none}
> SELECT ?uri ?var1 ?var2 ?varN
> WHERE {
>   ?uri a ex:type ;
>     ex:var1 ?var1 ;
>     ex:var2 ?var2 ;
>     ex:varN ?varN .
> }
> {code}
> KiWI performs quite bad, because it creates a {{CROSS JOIN}} for each 
> property:
> {code:sql}
> SELECT PN.object AS VN, P2.object AS V2, P1.subject AS V1
>  FROM triples P1
>  CROSS JOIN 
>   triples P2
>  CROSS JOIN 
>   triples PN
>  WHERE P1.deleted = false
>       AND P1.predicate = 520554470573084672
>       AND P1.object = 520588903665881088
>       AND (P1.context = 539803406462763008)
>        AND P2.deleted = false
>       AND P1.subject = P2.subject
>       AND P2.predicate = 520554473039335424
>       AND (P2.context = 539803406462763008)
>        AND PN.deleted = false
>       AND P1.subject = PN.subject
>       AND PN.predicate = 527860595421151232
>       AND (PN.context = 539803406462763008)
> {code}
> Making the subject fixed is actually a quite fast query.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to