1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

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
This commit is contained in:
Tom Lane
2024-04-03 17:41:54 -04:00
parent 97ce821e3e
commit 06286709ee
10 changed files with 542 additions and 11 deletions

View File

@@ -294,6 +294,9 @@ printtup_prepare_info(DR_printtup *myState, TupleDesc typeinfo, int numAttrs)
/* ----------------
* printtup --- send a tuple to the client
*
* Note: if you change this function, see also serializeAnalyzeReceive
* in explain.c, which is meant to replicate the computations done here.
* ----------------
*/
static bool
@@ -317,7 +320,7 @@ printtup(TupleTableSlot *slot, DestReceiver *self)
oldcontext = MemoryContextSwitchTo(myState->tmpcontext);
/*
* Prepare a DataRow message (note buffer is in per-row context)
* Prepare a DataRow message (note buffer is in per-query context)
*/
pq_beginmessage_reuse(buf, 'D');