Complex SPARQL query - Virtuoso performance hints?

老子叫甜甜 提交于 2019-12-01 20:21:34

First thing -- your Virtuoso build is long outdated; updating to 7.20.3217 as of April 2016 (or later) is strongly recommended.

Optimization suggestions are naturally limited when looking at a simplified query., but here are several thoughts, in no particular order...

  • Index Scheme Selection, the RDF Performance Tuning doc section following RDF Index Scheme, offers a couple of alternative and/or additional indexes which may make sense for your queries and data. As you say that some of your patterns will have defined graph and object, and undefined subject and predicate, some other indexes may also make sense (e.g., GOPS, GOSP), depending on some other factors.

  • Depending on how much your data has changed since original load, it may be worth rebuilding the free-text indexes, with this SQL command (which may be issued through any SQL interface -- iSQL, ODBC, JDBC, etc.) —

    VT_INC_INDEX_DB_DBA_RDF_OBJ ()
    
  • Using the bif:contains predicate can result in substantially better performance than regex() filters, for instance replacing —

    FILTER (isLiteral(?variableO) && REGEX(?variableO, "literalA", "i")) .
    

    — with —

    ?variableO bif:contains "'literalA'" .
    FILTER ( isLiteral(?variableO) ) .
    
  • Explain() and profile() can be helpful in query optimization efforts. Much of this output is meant for analysis by Development, so it may not mean much to you, but providing it to other Virtuoso users can still yield helpful suggestions.

  • For a number of reasons, the rdf:type predicate (often expressed as a, thanks to SPARQL/Turtle semantic sugar) can be a performance killer. Removing those predicates from your graph pattern is likely to boost performance substantially. If needed, there are other ways to limit the solution set (such as by testing for attributes only possessed by entities your desired rdf:type) which do not have such negative performance impacts.

(ObDisclaimer: OpenLink Software produces Virtuoso, and employs me.)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!