MCPcopy Create free account
hub / github.com/apache/cloudberry / ExecHashTableExplainBatches

Function ExecHashTableExplainBatches

src/backend/executor/nodeHash.c:2686–2802  ·  view source on GitHub ↗

* ExecHashTableExplainBatches * Report summary of EXPLAIN ANALYZE stats for a set of batches. */

Source from the content-addressed store, hash-verified

2684 * Report summary of EXPLAIN ANALYZE stats for a set of batches.
2685 */
2686static void
2687ExecHashTableExplainBatches(HashJoinTable hashtable,
2688 StringInfo buf,
2689 int ibatch_begin,
2690 int ibatch_end,
2691 const char *title)
2692{
2693 HashJoinTableStats *stats = hashtable->stats;
2694 CdbExplain_Agg irdbytes;
2695 CdbExplain_Agg iwrbytes;
2696 CdbExplain_Agg ordbytes;
2697 CdbExplain_Agg owrbytes;
2698 int i;
2699
2700 if (ibatch_begin >= ibatch_end)
2701 return;
2702
2703 Assert(ibatch_begin >= 0 &&
2704 ibatch_end <= hashtable->nbatch &&
2705 hashtable->nbatch <= stats->nbatchstats &&
2706 stats->batchstats != NULL);
2707
2708 cdbexplain_agg_init0(&irdbytes);
2709 cdbexplain_agg_init0(&iwrbytes);
2710 cdbexplain_agg_init0(&ordbytes);
2711 cdbexplain_agg_init0(&owrbytes);
2712
2713 /* Add up the batch stats. */
2714 for (i = ibatch_begin; i < ibatch_end; i++)
2715 {
2716 HashJoinBatchStats *bs = &stats->batchstats[i];
2717
2718 cdbexplain_agg_upd(&irdbytes, (double)bs->irdbytes, i);
2719 cdbexplain_agg_upd(&iwrbytes, (double)bs->iwrbytes, i);
2720 cdbexplain_agg_upd(&ordbytes, (double)bs->ordbytes, i);
2721 cdbexplain_agg_upd(&owrbytes, (double)bs->owrbytes, i);
2722 }
2723
2724 if (iwrbytes.vcnt + irdbytes.vcnt + owrbytes.vcnt + ordbytes.vcnt > 0)
2725 {
2726 if (ibatch_begin == ibatch_end - 1)
2727 appendStringInfo(buf,
2728 "%s batch %d:\n",
2729 title,
2730 ibatch_begin);
2731 else
2732 appendStringInfo(buf,
2733 "%s batches %d..%d:\n",
2734 title,
2735 ibatch_begin,
2736 ibatch_end - 1);
2737 }
2738
2739 /* Inner bytes read from workfile */
2740 if (irdbytes.vcnt > 0)
2741 {
2742 appendStringInfo(buf,
2743 " Read %.0fK bytes from inner workfile",

Callers 1

ExecHashTableExplainEndFunction · 0.85

Calls 5

cdbexplain_agg_init0Function · 0.85
cdbexplain_agg_updFunction · 0.85
appendStringInfoFunction · 0.85
cdbexplain_agg_avgFunction · 0.85
appendStringInfoStringFunction · 0.85

Tested by

no test coverage detected