Skip to content

Commit 19db23b

Browse files
committed
Revert "Include information on buffer usage during planning phase, in EXPLAIN output."
This reverts commit ed7a509. Per buildfarm member prion.
1 parent 18808f8 commit 19db23b

File tree

4 files changed

+8
-95
lines changed

4 files changed

+8
-95
lines changed

src/backend/commands/explain.c

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,7 @@ ExplainOneQuery(Query *query, int cursorOptions,
372372
PlannedStmt *plan;
373373
instr_time planstart,
374374
planduration;
375-
BufferUsage bufusage_start,
376-
bufusage;
377375

378-
if (es->buffers)
379-
bufusage_start = pgBufferUsage;
380376
INSTR_TIME_SET_CURRENT(planstart);
381377

382378
/* plan the query */
@@ -385,16 +381,9 @@ ExplainOneQuery(Query *query, int cursorOptions,
385381
INSTR_TIME_SET_CURRENT(planduration);
386382
INSTR_TIME_SUBTRACT(planduration, planstart);
387383

388-
/* calc differences of buffer counters. */
389-
if (es->buffers)
390-
{
391-
memset(&bufusage, 0, sizeof(BufferUsage));
392-
BufferUsageAccumDiff(&bufusage, &pgBufferUsage, &bufusage_start);
393-
}
394-
395384
/* run it (if needed) and produce output */
396385
ExplainOnePlan(plan, into, es, queryString, params, queryEnv,
397-
&planduration, (es->buffers ? &bufusage : NULL));
386+
&planduration);
398387
}
399388
}
400389

@@ -487,8 +476,7 @@ ExplainOneUtility(Node *utilityStmt, IntoClause *into, ExplainState *es,
487476
void
488477
ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
489478
const char *queryString, ParamListInfo params,
490-
QueryEnvironment *queryEnv, const instr_time *planduration,
491-
const BufferUsage *bufusage)
479+
QueryEnvironment *queryEnv, const instr_time *planduration)
492480
{
493481
DestReceiver *dest;
494482
QueryDesc *queryDesc;
@@ -572,29 +560,13 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
572560
/* Create textual dump of plan tree */
573561
ExplainPrintPlan(es, queryDesc);
574562

575-
if (es->summary && (planduration || bufusage))
576-
ExplainOpenGroup("Planning", "Planning", true, es);
577-
578563
if (es->summary && planduration)
579564
{
580565
double plantime = INSTR_TIME_GET_DOUBLE(*planduration);
581566

582567
ExplainPropertyFloat("Planning Time", "ms", 1000.0 * plantime, 3, es);
583568
}
584569

585-
/* Show buffer usage */
586-
if (es->summary && bufusage)
587-
{
588-
if (es->format == EXPLAIN_FORMAT_TEXT)
589-
es->indent++;
590-
show_buffer_usage(es, bufusage);
591-
if (es->format == EXPLAIN_FORMAT_TEXT)
592-
es->indent--;
593-
}
594-
595-
if (es->summary && (planduration || bufusage))
596-
ExplainCloseGroup("Planning", "Planning", true, es);
597-
598570
/* Print info about runtime of triggers */
599571
if (es->analyze)
600572
ExplainPrintTriggers(es, queryDesc);

src/backend/commands/prepare.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -616,11 +616,7 @@ ExplainExecuteQuery(ExecuteStmt *execstmt, IntoClause *into, ExplainState *es,
616616
EState *estate = NULL;
617617
instr_time planstart;
618618
instr_time planduration;
619-
BufferUsage bufusage_start,
620-
bufusage;
621619

622-
if (es->buffers)
623-
bufusage_start = pgBufferUsage;
624620
INSTR_TIME_SET_CURRENT(planstart);
625621

626622
/* Look it up in the hash table */
@@ -658,13 +654,6 @@ ExplainExecuteQuery(ExecuteStmt *execstmt, IntoClause *into, ExplainState *es,
658654
INSTR_TIME_SET_CURRENT(planduration);
659655
INSTR_TIME_SUBTRACT(planduration, planstart);
660656

661-
/* calc differences of buffer counters. */
662-
if (es->buffers)
663-
{
664-
memset(&bufusage, 0, sizeof(BufferUsage));
665-
BufferUsageAccumDiff(&bufusage, &pgBufferUsage, &bufusage_start);
666-
}
667-
668657
plan_list = cplan->stmt_list;
669658

670659
/* Explain each query */
@@ -674,7 +663,7 @@ ExplainExecuteQuery(ExecuteStmt *execstmt, IntoClause *into, ExplainState *es,
674663

675664
if (pstmt->commandType != CMD_UTILITY)
676665
ExplainOnePlan(pstmt, into, es, query_string, paramLI, queryEnv,
677-
&planduration, (es->buffers ? &bufusage : NULL));
666+
&planduration);
678667
else
679668
ExplainOneUtility(pstmt->utilityStmt, into, es, query_string,
680669
paramLI, queryEnv);

src/include/commands/explain.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into,
8989
extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into,
9090
ExplainState *es, const char *queryString,
9191
ParamListInfo params, QueryEnvironment *queryEnv,
92-
const instr_time *planduration,
93-
const BufferUsage *bufusage);
92+
const instr_time *planduration);
9493

9594
extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc);
9695
extern void ExplainPrintTriggers(ExplainState *es, QueryDesc *queryDesc);

src/test/regress/expected/explain.out

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,7 @@ select explain_filter('explain (analyze, buffers, format json) select * from int
105105
"Temp Read Blocks": N, +
106106
"Temp Written Blocks": N +
107107
}, +
108-
"Planning": { +
109-
"Planning Time": N.N, +
110-
"Shared Hit Blocks": N, +
111-
"Shared Read Blocks": N, +
112-
"Shared Dirtied Blocks": N, +
113-
"Shared Written Blocks": N, +
114-
"Local Hit Blocks": N, +
115-
"Local Read Blocks": N, +
116-
"Local Dirtied Blocks": N, +
117-
"Local Written Blocks": N, +
118-
"Temp Read Blocks": N, +
119-
"Temp Written Blocks": N +
120-
}, +
108+
"Planning Time": N.N, +
121109
"Triggers": [ +
122110
], +
123111
"Execution Time": N.N +
@@ -154,19 +142,7 @@ select explain_filter('explain (analyze, buffers, format xml) select * from int8
154142
<Temp-Read-Blocks>N</Temp-Read-Blocks> +
155143
<Temp-Written-Blocks>N</Temp-Written-Blocks> +
156144
</Plan> +
157-
<Planning> +
158-
<Planning-Time>N.N</Planning-Time> +
159-
<Shared-Hit-Blocks>N</Shared-Hit-Blocks> +
160-
<Shared-Read-Blocks>N</Shared-Read-Blocks> +
161-
<Shared-Dirtied-Blocks>N</Shared-Dirtied-Blocks>+
162-
<Shared-Written-Blocks>N</Shared-Written-Blocks>+
163-
<Local-Hit-Blocks>N</Local-Hit-Blocks> +
164-
<Local-Read-Blocks>N</Local-Read-Blocks> +
165-
<Local-Dirtied-Blocks>N</Local-Dirtied-Blocks> +
166-
<Local-Written-Blocks>N</Local-Written-Blocks> +
167-
<Temp-Read-Blocks>N</Temp-Read-Blocks> +
168-
<Temp-Written-Blocks>N</Temp-Written-Blocks> +
169-
</Planning> +
145+
<Planning-Time>N.N</Planning-Time> +
170146
<Triggers> +
171147
</Triggers> +
172148
<Execution-Time>N.N</Execution-Time> +
@@ -200,18 +176,7 @@ select explain_filter('explain (analyze, buffers, format yaml) select * from int
200176
Local Written Blocks: N +
201177
Temp Read Blocks: N +
202178
Temp Written Blocks: N +
203-
Planning: +
204-
Planning Time: N.N +
205-
Shared Hit Blocks: N +
206-
Shared Read Blocks: N +
207-
Shared Dirtied Blocks: N +
208-
Shared Written Blocks: N +
209-
Local Hit Blocks: N +
210-
Local Read Blocks: N +
211-
Local Dirtied Blocks: N +
212-
Local Written Blocks: N +
213-
Temp Read Blocks: N +
214-
Temp Written Blocks: N +
179+
Planning Time: N.N +
215180
Triggers: +
216181
Execution Time: N.N
217182
(1 row)
@@ -401,21 +366,9 @@ select jsonb_pretty(
401366
"Shared Dirtied Blocks": 0, +
402367
"Shared Written Blocks": 0 +
403368
}, +
404-
"Planning": { +
405-
"Planning Time": 0.0, +
406-
"Local Hit Blocks": 0, +
407-
"Temp Read Blocks": 0, +
408-
"Local Read Blocks": 0, +
409-
"Shared Hit Blocks": 0, +
410-
"Shared Read Blocks": 0, +
411-
"Temp Written Blocks": 0, +
412-
"Local Dirtied Blocks": 0, +
413-
"Local Written Blocks": 0, +
414-
"Shared Dirtied Blocks": 0, +
415-
"Shared Written Blocks": 0 +
416-
}, +
417369
"Triggers": [ +
418370
], +
371+
"Planning Time": 0.0, +
419372
"Execution Time": 0.0 +
420373
} +
421374
]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy