mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
Invent GENERIC_PLAN option for EXPLAIN.
This provides a very simple way to see the generic plan for a parameterized query. Without this, it's necessary to define a prepared statement and temporarily change plan_cache_mode, which is a bit tedious. One thing that's a bit of a hack perhaps is that we disable execution-time partition pruning when the GENERIC_PLAN option is given. That's because the pruning code may attempt to fetch the value of one of the parameters, which would fail. Laurenz Albe, reviewed by Julien Rouhaud, Christoph Berg, Michel Pelletier, Jim Jones, and myself Discussion: https://postgr.es/m/0a29b954b10b57f0d135fe12aa0909bd41883eb0.camel@cybertec.at
This commit is contained in:
@ -36,6 +36,11 @@
|
||||
* of startup should occur. However, error checks (such as permission checks)
|
||||
* should be performed.
|
||||
*
|
||||
* EXPLAIN_GENERIC can only be used together with EXPLAIN_ONLY. It indicates
|
||||
* that a generic plan is being shown using EXPLAIN (GENERIC_PLAN), which
|
||||
* means that missing parameter values must be tolerated. Currently, the only
|
||||
* effect is to suppress execution-time partition pruning.
|
||||
*
|
||||
* REWIND indicates that the plan node should try to efficiently support
|
||||
* rescans without parameter changes. (Nodes must support ExecReScan calls
|
||||
* in any case, but if this flag was not given, they are at liberty to do it
|
||||
@ -52,13 +57,18 @@
|
||||
* AfterTriggerBeginQuery/AfterTriggerEndQuery. This does not necessarily
|
||||
* mean that the plan can't queue any AFTER triggers; just that the caller
|
||||
* is responsible for there being a trigger context for them to be queued in.
|
||||
*
|
||||
* WITH_NO_DATA indicates that we are performing REFRESH MATERIALIZED VIEW
|
||||
* ... WITH NO DATA. Currently, the only effect is to suppress errors about
|
||||
* scanning unpopulated materialized views.
|
||||
*/
|
||||
#define EXEC_FLAG_EXPLAIN_ONLY 0x0001 /* EXPLAIN, no ANALYZE */
|
||||
#define EXEC_FLAG_REWIND 0x0002 /* need efficient rescan */
|
||||
#define EXEC_FLAG_BACKWARD 0x0004 /* need backward scan */
|
||||
#define EXEC_FLAG_MARK 0x0008 /* need mark/restore */
|
||||
#define EXEC_FLAG_SKIP_TRIGGERS 0x0010 /* skip AfterTrigger calls */
|
||||
#define EXEC_FLAG_WITH_NO_DATA 0x0020 /* rel scannability doesn't matter */
|
||||
#define EXEC_FLAG_EXPLAIN_ONLY 0x0001 /* EXPLAIN, no ANALYZE */
|
||||
#define EXEC_FLAG_EXPLAIN_GENERIC 0x0002 /* EXPLAIN (GENERIC_PLAN) */
|
||||
#define EXEC_FLAG_REWIND 0x0004 /* need efficient rescan */
|
||||
#define EXEC_FLAG_BACKWARD 0x0008 /* need backward scan */
|
||||
#define EXEC_FLAG_MARK 0x0010 /* need mark/restore */
|
||||
#define EXEC_FLAG_SKIP_TRIGGERS 0x0020 /* skip AfterTrigger setup */
|
||||
#define EXEC_FLAG_WITH_NO_DATA 0x0040 /* REFRESH ... WITH NO DATA */
|
||||
|
||||
|
||||
/* Hook for plugins to get control in ExecutorStart() */
|
||||
|
Reference in New Issue
Block a user