MCPcopy Create free account
hub / github.com/documentdb/documentdb / ExplainCompositeScanCore

Function ExplainCompositeScanCore

pg_documentdb/src/index_am/rum.c:1791–1847  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1789
1790
1791static void
1792ExplainCompositeScanCore(IndexScanDesc scan, void *state,
1793 ExplainWriterFuncs *writerFuncs)
1794{
1795 DocumentDBRumIndexState *outerScanState =
1796 (DocumentDBRumIndexState *) scan->opaque;
1797
1798 writerFuncs->writeBool("isMultiKey",
1799 outerScanState->multiKeyStatus ==
1800 IndexMultiKeyStatus_HasArrays,
1801 state);
1802
1803 if (outerScanState->hasCorrelatedReducedTerms)
1804 {
1805 writerFuncs->writeBool("hasCorrelatedTerms", true, state);
1806 }
1807
1808 bool hasTruncation = RumGetTruncationStatus(scan->indexRelation);
1809 if (hasTruncation)
1810 {
1811 writerFuncs->writeBool("hasTruncation", true, state);
1812 }
1813
1814 if (outerScanState->compositeKey.sk_argument != (Datum) 0)
1815 {
1816 List *rawPerPathBounds = NIL;
1817 List *boundsList = GetIndexBoundsForExplain(
1818 scan->indexRelation,
1819 outerScanState->compositeKey.sk_argument,
1820 scan->numberOfOrderBys > 0, &rawPerPathBounds);
1821
1822 if (rawPerPathBounds != NIL)
1823 {
1824 writerFuncs->writeStringList("startBounds", boundsList, state);
1825 writerFuncs->writeStringList("rawBounds", rawPerPathBounds, state);
1826 }
1827 else
1828 {
1829 writerFuncs->writeStringList("indexBounds", boundsList, state);
1830 }
1831 }
1832
1833 if (outerScanState->numDuplicates > 0)
1834 {
1835 /* If we have duplicates, explain the number of duplicates */
1836 writerFuncs->writeInteger("numDuplicates", "entries",
1837 outerScanState->numDuplicates, state);
1838 }
1839
1840 if (ScanDirectionIsBackward(outerScanState->scanDirection))
1841 {
1842 writerFuncs->writeBool("isBackwardScan", true, state);
1843 }
1844
1845 /* Explain the inner scan using underlying am */
1846 TryExplainByIndexAm(outerScanState->innerScan, writerFuncs, state);
1847}
1848

Callers 2

ExplainCompositeScanFunction · 0.85

Calls 3

RumGetTruncationStatusFunction · 0.85
GetIndexBoundsForExplainFunction · 0.85
TryExplainByIndexAmFunction · 0.85

Tested by

no test coverage detected