OSDN Git Service

Add JSON item for "Original Hash Buckets"
authorKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Wed, 24 Aug 2016 01:51:38 +0000 (10:51 +0900)
committerKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Fri, 26 Aug 2016 03:34:14 +0000 (12:34 +0900)
The previous version forgot to count that item as known and doesn't
show it in a text plan representation.

json2sql.pl
pgsp_json.c
pgsp_json_int.h
pgsp_json_text.c
pgsp_json_text.h

index a32c99a..d812d06 100755 (executable)
@@ -260,6 +260,7 @@ sub setplan0 {
   "Sort Space Type": "Memory",
   "Peak Memory Usage": 0,
   "Original Hash Batches": 0,
+  "Original Hash Buckets": 0,
   "Hash Batches": 0,
   "Hash Buckets": 0,
   "Rows Removed by Filter": 0,
index 00eb51a..d6c0078 100644 (file)
@@ -122,6 +122,7 @@ word_table propfields[] =
        {P_SortSpaceType,       "S" ,"Sort Space Type",         NULL, false, conv_sortspacetype,SETTER(sort_space_type)},
        {P_PeakMemoryUsage,     "T" ,"Peak Memory Usage",       NULL, false, NULL,                              SETTER(peak_memory_usage)},
        {P_OrgHashBatches,      "U","Original Hash Batches",NULL, false, NULL,                          SETTER(org_hash_batches)},
+       {P_OrgHashBuckets,      "*","Original Hash Buckets",NULL, false, NULL,                          SETTER(org_hash_buckets)},
        {P_HashBatches,         "V" ,"Hash Batches",            NULL, false, NULL,                              SETTER(hash_batches)},
        {P_HashBuckets,         "W" ,"Hash Buckets",            NULL, false, NULL,                              SETTER(hash_buckets)},
        {P_RowsFilterRmvd,      "X" ,"Rows Removed by Filter",NULL,false,NULL,                          SETTER(filter_removed)},
index 61d780a..dc2ce3a 100644 (file)
@@ -92,6 +92,7 @@ typedef enum
        P_SortSpaceType,
        P_PeakMemoryUsage,
        P_OrgHashBatches,
+       P_OrgHashBuckets,
        P_HashBatches,
        P_HashBuckets,
        P_RowsFilterRmvd,
index 1d82460..5d6df82 100644 (file)
@@ -123,6 +123,7 @@ DEFAULT_SETTER(filter_removed);
 DEFAULT_SETTER(idxrchk_removed);
 DEFAULT_SETTER(peak_memory_usage);
 DEFAULT_SETTER(org_hash_batches);
+DEFAULT_SETTER(org_hash_buckets);
 DEFAULT_SETTER(hash_batches);
 DEFAULT_SETTER(hash_buckets);
 DEFAULT_SETTER(actual_startup_time);
@@ -392,16 +393,32 @@ print_current_node(pgspParserContext *ctx)
 
        if (!ISZERO(v->hash_buckets))
        {
+               bool show_original = false;
+
                appendStringInfoString(s, "\n");
                appendStringInfoSpaces(s, TEXT_INDENT_DETAILS(level, exind));
                appendStringInfoString(s, "Buckets: ");
                appendStringInfoString(s, v->hash_buckets);
+
+               /* See show_hash_info() in explain.c for details */
+               if ((v->org_hash_buckets &&
+                        strcmp(v->hash_buckets, v->org_hash_buckets) != 0) ||
+                       (v->org_hash_batches &&
+                        strcmp(v->hash_batches, v->org_hash_batches) != 0))
+                       show_original = true;
+
+               if (show_original && v->org_hash_buckets)
+               {
+                       appendStringInfoString(s, " (originally ");
+                       appendStringInfoString(s, v->org_hash_buckets);
+                       appendStringInfoChar(s, ')');
+               }
+
                if (!ISZERO(v->hash_batches))
                {
                        appendStringInfoString(s, "  Batches: ");
                        appendStringInfoString(s, v->hash_batches);
-                       if (v->org_hash_batches &&
-                               strcmp(v->hash_batches, v->org_hash_batches) != 0)
+                       if (show_original && v->org_hash_batches)
                        {
                                appendStringInfoString(s, " (originally ");
                                appendStringInfoString(s, v->org_hash_batches);
index 8f59e98..4643cef 100644 (file)
@@ -40,6 +40,7 @@ typedef struct
        const char *setopcommand;
        const char *join_type;
        const char *org_hash_batches;
+       const char *org_hash_buckets;
        const char *peak_memory_usage;
        const char *startup_cost;
        const char *total_cost;
@@ -123,6 +124,7 @@ SETTERDECL(recheck_cond);
 SETTERDECL(hash_buckets);
 SETTERDECL(hash_batches);
 SETTERDECL(org_hash_batches);
+SETTERDECL(org_hash_buckets);
 SETTERDECL(peak_memory_usage);
 SETTERDECL(filter_removed);
 SETTERDECL(idxrchk_removed);