2011-02-20 06:17:18 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* nodeForeignscan.h
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
2021-01-02 19:06:25 +01:00
|
|
|
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
2011-02-20 06:17:18 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
* src/include/executor/nodeForeignscan.h
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef NODEFOREIGNSCAN_H
|
|
|
|
#define NODEFOREIGNSCAN_H
|
|
|
|
|
2016-02-03 18:46:18 +01:00
|
|
|
#include "access/parallel.h"
|
2011-02-20 06:17:18 +01:00
|
|
|
#include "nodes/execnodes.h"
|
|
|
|
|
|
|
|
extern ForeignScanState *ExecInitForeignScan(ForeignScan *node, EState *estate, int eflags);
|
|
|
|
extern void ExecEndForeignScan(ForeignScanState *node);
|
|
|
|
extern void ExecReScanForeignScan(ForeignScanState *node);
|
|
|
|
|
2016-02-03 18:46:18 +01:00
|
|
|
extern void ExecForeignScanEstimate(ForeignScanState *node,
|
|
|
|
ParallelContext *pcxt);
|
|
|
|
extern void ExecForeignScanInitializeDSM(ForeignScanState *node,
|
|
|
|
ParallelContext *pcxt);
|
Separate reinitialization of shared parallel-scan state from ExecReScan.
Previously, the parallel executor logic did reinitialization of shared
state within the ExecReScan code for parallel-aware scan nodes. This is
problematic, because it means that the ExecReScan call has to occur
synchronously (ie, during the parent Gather node's ReScan call). That is
swimming very much against the tide so far as the ExecReScan machinery is
concerned; the fact that it works at all today depends on a lot of fragile
assumptions, such as that no plan node between Gather and a parallel-aware
scan node is parameterized. Another objection is that because ExecReScan
might be called in workers as well as the leader, hacky extra tests are
needed in some places to prevent unwanted shared-state resets.
Hence, let's separate this code into two functions, a ReInitializeDSM
call and the ReScan call proper. ReInitializeDSM is called only in
the leader and is guaranteed to run before we start new workers.
ReScan is returned to its traditional function of resetting only local
state, which means that ExecReScan's usual habits of delaying or
eliminating child rescan calls are safe again.
As with the preceding commit 7df2c1f8d, it doesn't seem to be necessary
to make these changes in 9.6, which is a good thing because the FDW and
CustomScan APIs are impacted.
Discussion: https://postgr.es/m/CAA4eK1JkByysFJNh9M349u_nNjqETuEnY_y1VUc_kJiU0bxtaQ@mail.gmail.com
2017-08-30 19:18:16 +02:00
|
|
|
extern void ExecForeignScanReInitializeDSM(ForeignScanState *node,
|
|
|
|
ParallelContext *pcxt);
|
2016-02-03 18:46:18 +01:00
|
|
|
extern void ExecForeignScanInitializeWorker(ForeignScanState *node,
|
2017-11-17 02:28:11 +01:00
|
|
|
ParallelWorkerContext *pwcxt);
|
2017-02-26 09:06:49 +01:00
|
|
|
extern void ExecShutdownForeignScan(ForeignScanState *node);
|
2016-02-03 18:46:18 +01:00
|
|
|
|
Add support for asynchronous execution.
This implements asynchronous execution, which runs multiple parts of a
non-parallel-aware Append concurrently rather than serially to improve
performance when possible. Currently, the only node type that can be
run concurrently is a ForeignScan that is an immediate child of such an
Append. In the case where such ForeignScans access data on different
remote servers, this would run those ForeignScans concurrently, and
overlap the remote operations to be performed simultaneously, so it'll
improve the performance especially when the operations involve
time-consuming ones such as remote join and remote aggregation.
We may extend this to other node types such as joins or aggregates over
ForeignScans in the future.
This also adds the support for postgres_fdw, which is enabled by the
table-level/server-level option "async_capable". The default is false.
Robert Haas, Kyotaro Horiguchi, Thomas Munro, and myself. This commit
is mostly based on the patch proposed by Robert Haas, but also uses
stuff from the patch proposed by Kyotaro Horiguchi and from the patch
proposed by Thomas Munro. Reviewed by Kyotaro Horiguchi, Konstantin
Knizhnik, Andrey Lepikhov, Movead Li, Thomas Munro, Justin Pryzby, and
others.
Discussion: https://postgr.es/m/CA%2BTgmoaXQEt4tZ03FtQhnzeDEMzBck%2BLrni0UWHVVgOTnA6C1w%40mail.gmail.com
Discussion: https://postgr.es/m/CA%2BhUKGLBRyu0rHrDCMC4%3DRn3252gogyp1SjOgG8SEKKZv%3DFwfQ%40mail.gmail.com
Discussion: https://postgr.es/m/20200228.170650.667613673625155850.horikyota.ntt%40gmail.com
2021-03-31 11:45:00 +02:00
|
|
|
extern void ExecAsyncForeignScanRequest(AsyncRequest *areq);
|
|
|
|
extern void ExecAsyncForeignScanConfigureWait(AsyncRequest *areq);
|
|
|
|
extern void ExecAsyncForeignScanNotify(AsyncRequest *areq);
|
|
|
|
|
2011-02-20 06:17:18 +01:00
|
|
|
#endif /* NODEFOREIGNSCAN_H */
|