diff options
| author | Etsuro Fujita | 2021-05-12 05:00:00 +0000 |
|---|---|---|
| committer | Etsuro Fujita | 2021-05-12 05:00:00 +0000 |
| commit | a363bc6da96b14d27e1cae1bae97242eb6ade5e6 (patch) | |
| tree | 34b544b6df0502ad2bdc7a8ceb61f69f41de5eb0 /src/include/nodes/execnodes.h | |
| parent | e135743ef07ea59088d09c459f41ee2eaabe95c3 (diff) | |
Fix EXPLAIN ANALYZE for async-capable nodes.
EXPLAIN ANALYZE for an async-capable ForeignScan node associated with
postgres_fdw is done just by using instrumentation for ExecProcNode()
called from the node's callbacks, causing the following problems:
1) If the remote table to scan is empty, the node is incorrectly
considered as "never executed" by the command even if the node is
executed, as ExecProcNode() isn't called from the node's callbacks at
all in that case.
2) The command fails to collect timings for things other than
ExecProcNode() done in the node, such as creating a cursor for the
node's remote query.
To fix these problems, add instrumentation for async-capable nodes, and
modify postgres_fdw accordingly.
My oversight in commit 27e1f1456.
While at it, update a comment for the AsyncRequest struct in execnodes.h
and the documentation for the ForeignAsyncRequest API in fdwhandler.sgml
to match the code in ExecAsyncAppendResponse() in nodeAppend.c, and fix
typos in comments in nodeAppend.c.
Per report from Andrey Lepikhov, though I didn't use his patch.
Reviewed-by: Andrey Lepikhov
Discussion: https://postgr.es/m/2eb662bb-105d-fc20-7412-2f027cc3ca72%40postgrespro.ru
Diffstat (limited to 'src/include/nodes/execnodes.h')
| -rw-r--r-- | src/include/nodes/execnodes.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index e7ae21c023c..91a1c3a780e 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -538,7 +538,8 @@ typedef struct AsyncRequest int request_index; /* Scratch space for requestor */ bool callback_pending; /* Callback is needed */ bool request_complete; /* Request complete, result valid */ - TupleTableSlot *result; /* Result (NULL if no more tuples) */ + TupleTableSlot *result; /* Result (NULL or an empty slot if no more + * tuples) */ } AsyncRequest; /* ---------------- @@ -1003,6 +1004,8 @@ typedef struct PlanState ExprContext *ps_ExprContext; /* node's expression-evaluation context */ ProjectionInfo *ps_ProjInfo; /* info for doing tuple projection */ + bool async_capable; /* true if node is async-capable */ + /* * Scanslot's descriptor if known. This is a bit of a hack, but otherwise * it's hard for expression compilation to optimize based on the |
