diff options
| author | Tom Lane | 2024-04-03 21:41:54 +0000 |
|---|---|---|
| committer | Tom Lane | 2024-04-03 21:41:57 +0000 |
| commit | 06286709ee0637ec7376329a5aa026b7682dcfe2 (patch) | |
| tree | f1c4f4b606b28227c401be2722b1d08c924586e9 /src/include | |
| parent | 97ce821e3e171ce99fa7c398889ac08432cd0264 (diff) | |
Invent SERIALIZE option for EXPLAIN.
EXPLAIN (ANALYZE, SERIALIZE) allows collection of statistics about
the volume of data emitted by a query, as well as the time taken
to convert the data to the on-the-wire format. Previously there
was no way to investigate this without actually sending the data
to the client, in which case network transmission costs might
swamp what you wanted to see. In particular this feature allows
investigating the costs of de-TOASTing compressed or out-of-line
data during formatting.
Stepan Rutz and Matthias van de Meent,
reviewed by Tomas Vondra and myself
Discussion: https://postgr.es/m/ca0adb0e-fa4e-c37e-1cd7-91170b18cae1@gmx.de
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/commands/explain.h | 10 | ||||
| -rw-r--r-- | src/include/tcop/dest.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h index cf195f13597..9b8b351d9a2 100644 --- a/src/include/commands/explain.h +++ b/src/include/commands/explain.h @@ -17,6 +17,13 @@ #include "lib/stringinfo.h" #include "parser/parse_node.h" +typedef enum ExplainSerializeOption +{ + EXPLAIN_SERIALIZE_NONE, + EXPLAIN_SERIALIZE_TEXT, + EXPLAIN_SERIALIZE_BINARY, +} ExplainSerializeOption; + typedef enum ExplainFormat { EXPLAIN_FORMAT_TEXT, @@ -48,6 +55,7 @@ typedef struct ExplainState bool memory; /* print planner's memory usage information */ bool settings; /* print modified settings */ bool generic; /* generate a generic plan */ + ExplainSerializeOption serialize; /* serialize the query's output? */ ExplainFormat format; /* output format */ /* state for output formatting --- not reset for each new plan tree */ int indent; /* current indentation level */ @@ -132,4 +140,6 @@ extern void ExplainOpenGroup(const char *objtype, const char *labelname, extern void ExplainCloseGroup(const char *objtype, const char *labelname, bool labeled, ExplainState *es); +extern DestReceiver *CreateExplainSerializeDestReceiver(ExplainState *es); + #endif /* EXPLAIN_H */ diff --git a/src/include/tcop/dest.h b/src/include/tcop/dest.h index 7e613bd7fcc..a3d521b6f97 100644 --- a/src/include/tcop/dest.h +++ b/src/include/tcop/dest.h @@ -96,6 +96,7 @@ typedef enum DestSQLFunction, /* results sent to SQL-language func mgr */ DestTransientRel, /* results sent to transient relation */ DestTupleQueue, /* results sent to tuple queue */ + DestExplainSerialize, /* results are serialized and discarded */ } CommandDest; /* ---------------- |
