On 07/09/15 05:30, Wei Zhang wrote:
Dear All,
From the document (https://jena.apache.org/documentation/tdb/optimizer.html),
it is said TDB optimizer has both static and dynamic optimizations.
How can I get the estimated query time and row count instead of the actual time
and row count after static/dynamic optimization?
Another question is that I think "tdbquery -explain" gives the query plan after
execution, but it also cannot provide the information I want.
What I want is to find the TDB optimizer's performance.
Could anyone help?
Thank you very much for your time.
Best Regards,
Wei
Wei,
I think you have a model of how the optimizer works but it's at odds
with what it actually does. It is not strongly based around cost
estimation although TDB does a little of that.
The high level optimizations, done at the start of query execution, are
a set of rule based rewrites that look for patterns in the algebra and
produce better algebra. In particular, these are not based on the data.
Rather the rules are ways to standard SPARQL algebra (exactly as
produced by the transformation in the spec) into better (nearly always!)
algebra. That includes introducing a new operators (like "TopN") as
well as rewriting using existing operators (like filter/equality into a
pattern with that term and a BIND).
This is printed by "qparse --print=opt"
TDB adds reordering basic graph patterns, either by the rule based
method described at that link or a fixed way (roughly - choose mist
grounded triple pattern, but avoid rdf:type).
There are tools (QueryExecUtils) to execute algebra expressions directly
so combined with the optimizer switched off, you can try out different
possibilities.
Andy