W3C home > Mailing lists > Public > public-sparql-dev@w3.org > April to June 2009

RE: LIMIT problem (Paging)

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Mon, 25 May 2009 17:17:11 +0000
To: Steve Harris <swh@ecs.soton.ac.uk>, Mirko <idonthaveenoughinformation@googlemail.com>
CC: "public-sparql-dev@w3.org" <public-sparql-dev@w3.org>
Message-ID: <B6CF1054FDC8B845BF93A6645D19BEA3646C2E04B7@GVW1118EXC.americas.hpqcorp.net>


> -----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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 25 May 2009 17:18:08 GMT