sparql slow if more object value specified

Viewed 47

Using virtuoso 7 open source edition,

This query below is fast, it return the result instantly,

select *
                WHERE {

                graph <http://localhost:8890/graph> {

                            ?catAtt qq:catId ?catId;
                            qq:caDataType ?caDataType;
                            qq:showInView   ?showInview;
                            qq:valFormat    ?valFormatKey;
                            qq:multiple     ?multiple; 
                            qq:position     ?position; 
                            qq:link         ?link; 
                            qq:catAttName   ?catAttName; 
                            qq:setting      ?setting; 
                            qq:flag         ?flag;
                            qq:unit         ?caUnit.

                   

       
                  }  
                }
                
                
                LIMIT 20

This query is so slow, took 10 seconds for the result, the only difference is the ?catId is replaced with literal value 1

select *
                WHERE {

                graph <http://localhost:8890/graph> {

                            ?catAtt qq:catId 1;
                            qq:caDataType ?caDataType;
                            qq:showInView   ?showInview;
                            qq:valFormat    ?valFormatKey;
                            qq:multiple     ?multiple; 
                            qq:position     ?position; 
                            qq:link         ?link; 
                            qq:catAttName   ?catAttName; 
                            qq:setting      ?setting; 
                            qq:flag         ?flag;
                            qq:unit         ?caUnit.

                   

       
                  }  
                }
                
                
                LIMIT 20

Why is it so ? I am still new in sparql and triplestore, seems like I have to do some indexing on the object ?

EDIT :

I have tried creating the GOPS index with, I don't understand about the Partition part, is using O correct ? What does that partition mean ? Creating this index has improved the execution for the second query to 4 seconds, but still too slow for a DBMS.

CREATE COLUMN INDEX RDF_QUAD_GOPS
  ON RDF_QUAD (G, O, P, S)
  PARTITION (O VARCHAR (-1, 0hexffff));
1 Answers
Related