Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cost estimate for transitive path #383

Merged
merged 1 commit into from
Apr 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/engine/TransitivePath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@ size_t TransitivePath::getSizeEstimate() {
if (_rightSideTree != nullptr) {
return _rightSideTree->getSizeEstimate();
}
// Set costs to something very large, so that we never compute the complete
// transitive hull (unless the variables on both sides are not bound in any
// other way, so that the only possible query plan is to compute the complete
// transitive hull).
//
// NOTE: _subtree->getSizeEstimate() is the number of triples of the
// predicate, for which the transitive hull operator (+) is specified. On
// Wikidata, the predicate with the largest blowup when taking the
// transitive hull is wdt:P2789 (connects with). The blowup is then from 90K
// (without +) to 110M (with +), so about 1000 times larger.
if (_leftIsVar && _rightIsVar) {
return _subtree->getSizeEstimate() * 10000;
}
// TODO(Florian): this is not necessarily a good estimator
if (_leftIsVar) {
return _subtree->getSizeEstimate() / _subtree->getMultiplicity(_leftSubCol);
Expand Down