Optimize by collapsing trees into single SQL queries

This commit is contained in:
Barak Michener 2015-07-22 19:11:59 -04:00
parent 185e236f15
commit 621acae945
7 changed files with 501 additions and 50 deletions

View file

@ -105,6 +105,14 @@ func (it *HasA) Optimize() (graph.Iterator, bool) {
return it.primaryIt, true
}
}
// Ask the graph.QuadStore if we can be replaced. Often times, this is a great
// optimization opportunity (there's a fixed iterator underneath us, for
// example).
newReplacement, hasOne := it.qs.OptimizeIterator(it)
if hasOne {
it.Close()
return newReplacement, true
}
return it, false
}