| 1589 | |
| 1590 | |
| 1591 | static void |
| 1592 | ExplainCompositeProperties(void *state, GetMultikeyStatusFunc multiKeyStatusFunc, |
| 1593 | Relation index_rel, bool enableCompositeReducedCorrelatedTerms, |
| 1594 | List *indexQuals, List *indexOrderBy, bool |
| 1595 | supportsOrderedOperatorScans, |
| 1596 | void (*writeBoolFunc)(const char *, bool, void *), |
| 1597 | void (*writeStringListFunc)(const char *, List *, void *)) |
| 1598 | { |
| 1599 | bool isMultiKey = multiKeyStatusFunc ? multiKeyStatusFunc(index_rel) : |
| 1600 | RumGetMultiKeyStatusSlow(index_rel); |
| 1601 | writeBoolFunc("isMultiKey", isMultiKey, state); |
| 1602 | |
| 1603 | bool hasCorrelatedTerms = false; |
| 1604 | if (enableCompositeReducedCorrelatedTerms && isMultiKey) |
| 1605 | { |
| 1606 | /* Check if we have correlated reduced terms */ |
| 1607 | EnsureRumLibLoaded(); |
| 1608 | hasCorrelatedTerms = CheckIndexHasReducedTerms(index_rel, &rum_index_routine); |
| 1609 | } |
| 1610 | |
| 1611 | if (hasCorrelatedTerms) |
| 1612 | { |
| 1613 | writeBoolFunc("hasCorrelatedTerms", true, state); |
| 1614 | } |
| 1615 | |
| 1616 | bool isTruncated = RumGetTruncationStatus(index_rel); |
| 1617 | if (isTruncated) |
| 1618 | { |
| 1619 | writeBoolFunc("hasTruncation", true, state); |
| 1620 | } |
| 1621 | |
| 1622 | Datum compositeDatum = FormCompositeDatumFromQuals(indexQuals, indexOrderBy, |
| 1623 | isMultiKey, hasCorrelatedTerms, |
| 1624 | supportsOrderedOperatorScans); |
| 1625 | if (compositeDatum != 0) |
| 1626 | { |
| 1627 | List *rawPerPathBounds = NIL; |
| 1628 | List *boundsList = GetIndexBoundsForExplain(index_rel, compositeDatum, |
| 1629 | list_length(indexOrderBy) > 0, |
| 1630 | &rawPerPathBounds); |
| 1631 | if (rawPerPathBounds != NIL) |
| 1632 | { |
| 1633 | writeStringListFunc("startBounds", boundsList, state); |
| 1634 | writeStringListFunc("rawBounds", rawPerPathBounds, state); |
| 1635 | } |
| 1636 | else |
| 1637 | { |
| 1638 | writeStringListFunc("indexBounds", boundsList, state); |
| 1639 | } |
| 1640 | } |
| 1641 | } |
| 1642 | |
| 1643 | |
| 1644 | static void |
no test coverage detected