Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/174#discussion_r45080794
--- Diff: core/sql/optimizer/ScanOptimizer.cpp ---
@@ -3364,7 +3364,25 @@ ScanOptimizer::isMdamEnabled() const
// If # of probes for NJ is <= cqd(MDAM_UNDER_NJ_PROBES_THRESHOLD),
// we will use MDAM regardless of the setting of CQD MDAM_SCAN_METHOD.
- // When the CQD is 0, MDAM under NJ is not considered.
+ // When the CQD is 0, MDAM under NJ is not considered unless we
+ // have a cardinality constraint on the number of probes that
+ // guarantees at most one probe.
+
+ const InputPhysicalProperty* ippForMe =
+ getContext().getInputPhysicalProperty();
+ if (ippForMe)
+ {
+ const CardConstraint * outerCardConstraint =
+ ippForMe->getOuterCardConstraint();
+ if (outerCardConstraint)
+ {
+ Cardinality upperBound = outerCardConstraint->getUpperBound();
+ if (upperBound <= (Cardinality)1)
--- End diff --
There is already a CQD just a few lines down in the code that will allow
this for estimates. I wanted to avoid introducing yet another CQD. That was the
point of the code a few lines down that used the cardinality constraint to
sharpen the row estimate.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---