RE: LIMIT problem (Paging)



> -----Original Message-----
> From: public-sparql-dev-request@w3.org [mailto:public-sparql-dev-
> request@w3.org] On Behalf Of Steve Harris
> Sent: 25 May 2009 10:05
> To: Mirko
> Cc: public-sparql-dev@w3.org
> Subject: Re: LIMIT problem (Paging)
> 
> On 23 May 2009, at 17:41, Mirko wrote:
> 
> > Hi all,
> > I have an understanding problem with paging (limit/offet) in Sparql.
> >
> > Consider the following query:
> >
> > Select ?userID ?itemID ?date WHERE {
> >  ?user my:hasUserID ?userID
> > .. ?user my:owns ?item
> > .. ?item my:hasItemID ?itemID
> > .. ?item my:soldToUser ?date
> > .. FILTER (?date > 20090101)
> > }
> > ORDER BY ?userID
> > LIMIT 1000
> > OFFSET 0
> >
> > A user might own multiple items.
> >
> > The results are to large to keep in memory, so I would like to page
> > them using LIMIT and OFFSET. However it does not work with the above
> > query. The query above needs all results to be loaded into memory
> > when evaluating it. I assume this is because more than one statement
> > is evaluated in the WHERE clause(?).
> 
> It should work in theory, I think this is a question for whoever wrote
> your RDF store.
> 
> - Steve

If you can avoid the ORDER BY, it's going to help because either the engine is going to have to sort on all user ids before doing LIMIT 1000, or it's going to have to know things will come out in the right order anyway (store dependent).

If you are going to page all the results sometime, it is better to not use LIMIT/OFFSET if your SPAQRL engine streams results.

 Andy

Received on Monday, 25 May 2009 17:18:07 UTC