| 1942 | |
| 1943 | |
| 1944 | void |
| 1945 | RecordCostEstimateForIndex(Oid indexOid, Oid relOid, Cost indexStartupCost, |
| 1946 | Cost indexTotalCost, Selectivity indexSelectivity, |
| 1947 | double indexCorrelation, double indexPages, double |
| 1948 | totalIndexPages, double totalIndexTuples, |
| 1949 | double boundarySelectivity, int numBoundaryQuals, |
| 1950 | double dataPagesProportionFetched) |
| 1951 | { |
| 1952 | if (!EnableExtendedExplainPlans || !EnableExplainScanIndexCosts) |
| 1953 | { |
| 1954 | return; |
| 1955 | } |
| 1956 | |
| 1957 | IndexCostsData *costData = NULL; |
| 1958 | for (int i = 0; i < IndexExplainCostsIndex; i++) |
| 1959 | { |
| 1960 | if (IndexExplainCosts[i].indexOid == indexOid) |
| 1961 | { |
| 1962 | /* We already have an entry for this index - update it with the new cost */ |
| 1963 | costData = &IndexExplainCosts[i]; |
| 1964 | break; |
| 1965 | } |
| 1966 | } |
| 1967 | |
| 1968 | if (costData == NULL && IndexExplainCostsIndex < MAX_EXPLAIN_COSTS_SIZE) |
| 1969 | { |
| 1970 | costData = &IndexExplainCosts[IndexExplainCostsIndex++]; |
| 1971 | } |
| 1972 | |
| 1973 | if (costData != NULL) |
| 1974 | { |
| 1975 | costData->indexOid = indexOid; |
| 1976 | costData->relOid = relOid; |
| 1977 | costData->indexStartupCost = indexStartupCost; |
| 1978 | costData->indexTotalCost = indexTotalCost; |
| 1979 | costData->indexSelectivity = indexSelectivity; |
| 1980 | costData->indexCorrelation = indexCorrelation; |
| 1981 | costData->indexPages = indexPages; |
| 1982 | costData->totalIndexPages = totalIndexPages; |
| 1983 | costData->totalIndexEntries = totalIndexTuples; |
| 1984 | costData->boundarySelectivity = boundarySelectivity; |
| 1985 | costData->numBoundaryQuals = numBoundaryQuals; |
| 1986 | costData->dataPagesProportionFetched = dataPagesProportionFetched; |
| 1987 | } |
| 1988 | } |
| 1989 | |
| 1990 | |
| 1991 | static int32_t |
no outgoing calls
no test coverage detected