@@ -120,13 +120,15 @@ static void show_sort_group_keys(PlanState *planstate, const char *qlabel,
120
120
List * ancestors , ExplainState * es );
121
121
static void show_sortorder_options (StringInfo buf , Node * sortexpr ,
122
122
Oid sortOperator , Oid collation , bool nullsFirst );
123
+ static void show_storage_info (Tuplestorestate * tupstore , ExplainState * es );
123
124
static void show_tablesample (TableSampleClause * tsc , PlanState * planstate ,
124
125
List * ancestors , ExplainState * es );
125
126
static void show_sort_info (SortState * sortstate , ExplainState * es );
126
127
static void show_incremental_sort_info (IncrementalSortState * incrsortstate ,
127
128
ExplainState * es );
128
129
static void show_hash_info (HashState * hashstate , ExplainState * es );
129
130
static void show_material_info (MaterialState * mstate , ExplainState * es );
131
+ static void show_windowagg_info (WindowAggState * winstate , ExplainState * es );
130
132
static void show_memoize_info (MemoizeState * mstate , List * ancestors ,
131
133
ExplainState * es );
132
134
static void show_hashagg_info (AggState * aggstate , ExplainState * es );
@@ -2231,6 +2233,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
2231
2233
planstate , es );
2232
2234
show_upper_qual (((WindowAgg * ) plan )-> runConditionOrig ,
2233
2235
"Run Condition" , planstate , ancestors , es );
2236
+ show_windowagg_info (castNode (WindowAggState , planstate ), es );
2234
2237
break ;
2235
2238
case T_Group :
2236
2239
show_group_keys (castNode (GroupState , planstate ), ancestors , es );
@@ -2894,6 +2897,34 @@ show_sortorder_options(StringInfo buf, Node *sortexpr,
2894
2897
}
2895
2898
}
2896
2899
2900
+ /*
2901
+ * Show information on storage method and maximum memory/disk space used.
2902
+ */
2903
+ static void
2904
+ show_storage_info (Tuplestorestate * tupstore , ExplainState * es )
2905
+ {
2906
+ char * maxStorageType ;
2907
+ int64 maxSpaceUsed ,
2908
+ maxSpaceUsedKB ;
2909
+
2910
+ tuplestore_get_stats (tupstore , & maxStorageType , & maxSpaceUsed );
2911
+ maxSpaceUsedKB = BYTES_TO_KILOBYTES (maxSpaceUsed );
2912
+
2913
+ if (es -> format != EXPLAIN_FORMAT_TEXT )
2914
+ {
2915
+ ExplainPropertyText ("Storage" , maxStorageType , es );
2916
+ ExplainPropertyInteger ("Maximum Storage" , "kB" , maxSpaceUsedKB , es );
2917
+ }
2918
+ else
2919
+ {
2920
+ ExplainIndentText (es );
2921
+ appendStringInfo (es -> str ,
2922
+ "Storage: %s Maximum Storage: " INT64_FORMAT "kB\n" ,
2923
+ maxStorageType ,
2924
+ maxSpaceUsedKB );
2925
+ }
2926
+ }
2927
+
2897
2928
/*
2898
2929
* Show TABLESAMPLE properties
2899
2930
*/
@@ -3350,9 +3381,6 @@ static void
3350
3381
show_material_info (MaterialState * mstate , ExplainState * es )
3351
3382
{
3352
3383
Tuplestorestate * tupstore = mstate -> tuplestorestate ;
3353
- char * maxStorageType ;
3354
- int64 maxSpaceUsed ,
3355
- maxSpaceUsedKB ;
3356
3384
3357
3385
/*
3358
3386
* Nothing to show if ANALYZE option wasn't used or if execution didn't
@@ -3361,22 +3389,26 @@ show_material_info(MaterialState *mstate, ExplainState *es)
3361
3389
if (!es -> analyze || tupstore == NULL )
3362
3390
return ;
3363
3391
3364
- tuplestore_get_stats (tupstore , & maxStorageType , & maxSpaceUsed );
3365
- maxSpaceUsedKB = BYTES_TO_KILOBYTES ( maxSpaceUsed );
3392
+ show_storage_info (tupstore , es );
3393
+ }
3366
3394
3367
- if (es -> format != EXPLAIN_FORMAT_TEXT )
3368
- {
3369
- ExplainPropertyText ("Storage" , maxStorageType , es );
3370
- ExplainPropertyInteger ("Maximum Storage" , "kB" , maxSpaceUsedKB , es );
3371
- }
3372
- else
3373
- {
3374
- ExplainIndentText (es );
3375
- appendStringInfo (es -> str ,
3376
- "Storage: %s Maximum Storage: " INT64_FORMAT "kB\n" ,
3377
- maxStorageType ,
3378
- maxSpaceUsedKB );
3379
- }
3395
+ /*
3396
+ * Show information on WindowAgg node, storage method and maximum memory/disk
3397
+ * space used.
3398
+ */
3399
+ static void
3400
+ show_windowagg_info (WindowAggState * winstate , ExplainState * es )
3401
+ {
3402
+ Tuplestorestate * tupstore = winstate -> buffer ;
3403
+
3404
+ /*
3405
+ * Nothing to show if ANALYZE option wasn't used or if execution didn't
3406
+ * get as far as creating the tuplestore.
3407
+ */
3408
+ if (!es -> analyze || tupstore == NULL )
3409
+ return ;
3410
+
3411
+ show_storage_info (tupstore , es );
3380
3412
}
3381
3413
3382
3414
/*
0 commit comments