aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/explain.c
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2021-04-01 13:33:23 +1300
committerDavid Rowley <drowley@postgresql.org>2021-04-01 13:33:23 +1300
commit28b3e3905c982c42fb10ee800e6f881e9742c89d (patch)
tree5368a84ddedf0c0da61fc9ec73ea148658821f0b /src/backend/commands/explain.c
parentb6002a796dc0bfe721db5eaa54ba9d24fd9fd416 (diff)
downloadpostgresql-28b3e3905c982c42fb10ee800e6f881e9742c89d.tar.gz
postgresql-28b3e3905c982c42fb10ee800e6f881e9742c89d.zip
Revert b6002a796
This removes "Add Result Cache executor node". It seems that something weird is going on with the tracking of cache hits and misses as highlighted by many buildfarm animals. It's not yet clear what the problem is as other parts of the plan indicate that the cache did work correctly, it's just the hits and misses that were being reported as 0. This is especially a bad time to have the buildfarm so broken, so reverting before too many more animals go red. Discussion: https://postgr.es/m/CAApHDvq_hydhfovm4=izgWs+C5HqEeRScjMbOgbpC-jRAeK3Yw@mail.gmail.com
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r--src/backend/commands/explain.c140
1 files changed, 0 insertions, 140 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index b0582d7826a..872aaa7aedc 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -108,8 +108,6 @@ static void show_sort_info(SortState *sortstate, ExplainState *es);
static void show_incremental_sort_info(IncrementalSortState *incrsortstate,
ExplainState *es);
static void show_hash_info(HashState *hashstate, ExplainState *es);
-static void show_resultcache_info(ResultCacheState *rcstate, List *ancestors,
- ExplainState *es);
static void show_hashagg_info(AggState *hashstate, ExplainState *es);
static void show_tidbitmap_info(BitmapHeapScanState *planstate,
ExplainState *es);
@@ -1286,9 +1284,6 @@ ExplainNode(PlanState *planstate, List *ancestors,
case T_Material:
pname = sname = "Materialize";
break;
- case T_ResultCache:
- pname = sname = "Result Cache";
- break;
case T_Sort:
pname = sname = "Sort";
break;
@@ -2001,10 +1996,6 @@ ExplainNode(PlanState *planstate, List *ancestors,
case T_Hash:
show_hash_info(castNode(HashState, planstate), es);
break;
- case T_ResultCache:
- show_resultcache_info(castNode(ResultCacheState, planstate),
- ancestors, es);
- break;
default:
break;
}
@@ -3073,137 +3064,6 @@ show_hash_info(HashState *hashstate, ExplainState *es)
}
/*
- * Show information on result cache hits/misses/evictions and memory usage.
- */
-static void
-show_resultcache_info(ResultCacheState *rcstate, List *ancestors, ExplainState *es)
-{
- Plan *plan = ((PlanState *) rcstate)->plan;
- ListCell *lc;
- List *context;
- StringInfoData keystr;
- char *seperator = "";
- bool useprefix;
- int64 memPeakKb;
-
- initStringInfo(&keystr);
-
- /*
- * It's hard to imagine having a result cache with fewer than 2 RTEs, but
- * let's just keep the same useprefix logic as elsewhere in this file.
- */
- useprefix = list_length(es->rtable) > 1 || es->verbose;
-
- /* Set up deparsing context */
- context = set_deparse_context_plan(es->deparse_cxt,
- plan,
- ancestors);
-
- foreach(lc, ((ResultCache *) plan)->param_exprs)
- {
- Node *expr = (Node *) lfirst(lc);
-
- appendStringInfoString(&keystr, seperator);
-
- appendStringInfoString(&keystr, deparse_expression(expr, context,
- useprefix, false));
- seperator = ", ";
- }
-
- if (es->format != EXPLAIN_FORMAT_TEXT)
- {
- ExplainPropertyText("Cache Key", keystr.data, es);
- }
- else
- {
- ExplainIndentText(es);
- appendStringInfo(es->str, "Cache Key: %s\n", keystr.data);
- }
-
- pfree(keystr.data);
-
- if (!es->analyze)
- return;
-
- /*
- * mem_peak is only set when we freed memory, so we must use mem_used when
- * mem_peak is 0.
- */
- if (rcstate->stats.mem_peak > 0)
- memPeakKb = (rcstate->stats.mem_peak + 1023) / 1024;
- else
- memPeakKb = (rcstate->mem_used + 1023) / 1024;
-
- if (es->format != EXPLAIN_FORMAT_TEXT)
- {
- ExplainPropertyInteger("Cache Hits", NULL, rcstate->stats.cache_hits, es);
- ExplainPropertyInteger("Cache Misses", NULL, rcstate->stats.cache_misses, es);
- ExplainPropertyInteger("Cache Evictions", NULL, rcstate->stats.cache_evictions, es);
- ExplainPropertyInteger("Cache Overflows", NULL, rcstate->stats.cache_overflows, es);
- ExplainPropertyInteger("Peak Memory Usage", "kB", memPeakKb, es);
- }
- else
- {
- ExplainIndentText(es);
- appendStringInfo(es->str,
- "Hits: " UINT64_FORMAT " Misses: " UINT64_FORMAT " Evictions: " UINT64_FORMAT " Overflows: " UINT64_FORMAT " Memory Usage: " INT64_FORMAT "kB\n",
- rcstate->stats.cache_hits,
- rcstate->stats.cache_misses,
- rcstate->stats.cache_evictions,
- rcstate->stats.cache_overflows,
- memPeakKb);
- }
-
- if (rcstate->shared_info == NULL)
- return;
-
- /* Show details from parallel workers */
- for (int n = 0; n < rcstate->shared_info->num_workers; n++)
- {
- ResultCacheInstrumentation *si;
-
- si = &rcstate->shared_info->sinstrument[n];
-
- if (es->workers_state)
- ExplainOpenWorker(n, es);
-
- /*
- * Since the worker's ResultCacheState.mem_used field is unavailable
- * to us, ExecEndResultCache will have set the
- * ResultCacheInstrumentation.mem_peak field for us. No need to do
- * the zero checks like we did for the serial case above.
- */
- memPeakKb = (si->mem_peak + 1023) / 1024;
-
- if (es->format == EXPLAIN_FORMAT_TEXT)
- {
- ExplainIndentText(es);
- appendStringInfo(es->str,
- "Hits: " UINT64_FORMAT " Misses: " UINT64_FORMAT " Evictions: " UINT64_FORMAT " Overflows: " UINT64_FORMAT " Memory Usage: " INT64_FORMAT "kB\n",
- si->cache_hits, si->cache_misses,
- si->cache_evictions, si->cache_overflows,
- memPeakKb);
- }
- else
- {
- ExplainPropertyInteger("Cache Hits", NULL,
- si->cache_hits, es);
- ExplainPropertyInteger("Cache Misses", NULL,
- si->cache_misses, es);
- ExplainPropertyInteger("Cache Evictions", NULL,
- si->cache_evictions, es);
- ExplainPropertyInteger("Cache Overflows", NULL,
- si->cache_overflows, es);
- ExplainPropertyInteger("Peak Memory Usage", "kB", memPeakKb,
- es);
- }
-
- if (es->workers_state)
- ExplainCloseWorker(n, es);
- }
-}
-
-/*
* Show information on hash aggregate memory usage and batches.
*/
static void