Hello Sebastian,

It's hard to diagnose without dumps of EXPLAINs of these queries.
Most probably, the last triple pattern has been moved toward the leading
position because the selectivity of the fixed object variant was
overestimated. You can try to check variants that restrict graphs, if
that is possible. E.g., the following may be correct:

select distinct ?r where {
  { graph ?g { ?r ?v1 ?v2 .
    FILTER(bif:contains(?v2, \"'hello' AND 'world'\")) . }
  }
  UNION
  { graph ?g { ?r ?v1 ?v3 .
    ?v3 ?v4 ?v2 .
    FILTER(bif:contains(?v2, \"'hello' AND 'world'\")) .
      }
    ?v4 rdfs:subPropertyOf rdfs:label .
  } .
  graph ?g { ?r nao:userVisible 1 }
}

Best Regards,

Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com

On Mon, 2011-01-10 at 16:22 +0100, Sebastian Trüg wrote:
> Hi list,
> 
> again I have a question about query performance: why is there a big
> difference in query execution time between
> 
> select distinct ?r ?v where {
>   { ?r ?v1 ?v2 .
>     FILTER(bif:contains(?v2, "'hello' AND 'world'")) .
>   }
>   UNION
>   { ?r ?v1 ?v3 .
>     ?v3 ?v4 ?v2 .
>     ?v4 rdfs:subPropertyOf rdfs:label .
>     FILTER(bif:contains(?v2, \"'hello' AND 'world'\")) .
>   } .
>   ?r nao:userVisible ?v
> }
> 
> and
> 
> select distinct ?r where {
>   { ?r ?v1 ?v2 .
>     FILTER(bif:contains(?v2, \"'hello' AND 'world'\")) .
>   }
>   UNION
>   { ?r ?v1 ?v3 .
>     ?v3 ?v4 ?v2 .
>     ?v4 rdfs:subPropertyOf rdfs:label .
>     FILTER(bif:contains(?v2, \"'hello' AND 'world'\")) .
>   } .
>   ?r nao:userVisible 1
> }
> 
> The first one returns in no time while the second one takes time.
> 
> Any ideas?
> 
> Cheers,
> Sebastian
> 
> ------------------------------------------------------------------------------
> Gaining the trust of online customers is vital for the success of any company
> that requires sensitive data to be transmitted over the Web.   Learn how to 
> best implement a security strategy that keeps consumers' information secure 
> and instills the confidence they need to proceed with transactions.
> http://p.sf.net/sfu/oracle-sfdevnl 
> _______________________________________________
> Virtuoso-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users



Reply via email to