openRDF.org Welcome Guest   | Login   
  Search  
  Index  | Recent Threads  | Who's Online  | User List  | Search  | Help  | RSS feeds

Forum closing down
This forum will be closing down due to extensive spamming activities. As a first step, registration of new members has been disabled. Existing members will be able to use the forum for now, but please consider using the sesame-general mailing list instead.


Quick Go »
Thread Status: Normal
Total posts in this thread: 3
[Add To My Favorites] [Watch this Thread] [Post new Thread]
Author
Previous Thread This topic has been viewed 3088 times and has 2 replies Next Thread
Sep 16, 2007 2:28:59 AM

hendlerman
Regular
Member's Avatar


Joined: Sep 14, 2004
Posts: 36
Status: Offline
SPARQL syntax effects speed Reply to this Post
Reply with Quote

I seemed to have gained quite a lot of time by moving a FILTER to the end of a SPARQL statement instead of the beginning. This would make sense since the first statement in the query would be more efficient than a FILTER - but I wanted to make sure I wasn't imagining this.


//find grammy and grandpa

//was like
?subject ?p ?o .
FILTER(REGEX(str(?object),"^gra")) .
?subject ns:hasnick ?object .

//is now
?subject ?p ?o .
?subject ns:hasnick ?object .
FILTER(REGEX(str(?object),"^gra")) .



Also, obviously, OPTIONALS are slower, and it may be faster to retrieve additional data as a separate query. Is this also a common finding among users?
----------------------------------------
[Edit 2 times, last edit by hendlerman at Sep 16, 2007 3:17:34 AM]
Show Printable Version of Post        Hidden to Guest    http://semanticsearch.org [Link] Report threatening or abusive post: please login first  Go to top 
Sep 17, 2007 4:03:46 PM

arjohn
OpenRDF project lead
Member's Avatar

The Netherlands
Joined: Jan 23, 2004
Posts: 1289
Status: Offline
Re: SPARQL syntax effects speed Reply to this Post
Reply with Quote

 
I seemed to have gained quite a lot of time by moving a FILTER to the end of a SPARQL statement instead of the beginning. This would make sense since the first statement in the query would be more efficient than a FILTER - but I wanted to make sure I wasn't imagining this.


//find grammy and grandpa

//was like
?subject ?p ?o .
FILTER(REGEX(str(?object),"^gra")) .
?subject ns:hasnick ?object .

//is now
?subject ?p ?o .
?subject ns:hasnick ?object .
FILTER(REGEX(str(?object),"^gra")) .


I can't quite explain the difference. Both queries are parsed to the exact same query model so query evaluation performance should be identical. There must be some other reason for the difference.
----------------------------------------
Arjohn Kampman, OpenRDF project lead, Aduna
Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Sep 17, 2007 6:50:15 PM

hendlerman
Regular
Member's Avatar


Joined: Sep 14, 2004
Posts: 36
Status: Offline
Re: SPARQL syntax effects speed? Reply to this Post
Reply with Quote

 
I can't quite explain the difference. Both queries are parsed to the exact same query model so query evaluation performance should be identical. There must be some other reason for the difference.


The specific query I have there is not actually the query I'm doing, but it does show that I've moved the filter later in the statement. I've gotten another answer, I think, here http://www.openrdf.org/forum/mvnforum/viewthread?thread=1431#5387 saying that it may matter.
Show Printable Version of Post        Hidden to Guest    http://semanticsearch.org [Link] Report threatening or abusive post: please login first  Go to top 
[Show Printable Version of Thread] [Post new Thread]