On 08/03/12 21:59, Robert Vesse wrote:
I don't know a lot about the internals of TDB but it may be that the
two queries are broadly speaking equivalent i.e. in order for TDB to
determine what graphs are in the dataset it still has to do a full
scan because AFAIK it is just storing quads and not necessarily
storing any record of what named graphs are present independent of
the quads - am I correct in this assumption Andy?

Yes.

If that is the case the only reason my suggested query is faster is
because it doesn't have to store the ?s ?p ?o solutions that the
first method generates

If the SELECT clause does not touch ?s ?p ?o then they are not fetched from the node table (the binding is delayed evaluation - if you don't touch a variable, it's not converted from NodeId to node)

e.g. SELECT (count(*) AS ?C) { ?s ?p ?o }

does not touch the node table at all.

        Andy


Rob

Reply via email to