typedb
typedb copied to clipboard
Smooth reasoner planner answer count estimates
Problem to Solve
The reasoner planner estimates the number of answers to a constraint based on the statistics (counts) TypeDB collects for each vertices and edges. If the count for one of these is 0, the answer count estimator may return an estimate of 0, incentivising the planner to schedule this constraint first.
This is a valid strategy, but one that lead to the selection of bad plans if the count wasn't actually 0.
Current Workaround
None
Proposed Solution
Assuming the statistics cannot return perfect information, applying simple additive smoothing on the statistics returned should protect the planner from the zero propagating and causing plans (which are expensive in reality) from being assigned a zero cost. .