mirror of
https://github.com/postgres/postgres.git
synced 2025-10-15 05:46:52 +03:00
Assign each subquery a unique name prior to planning it.
Previously, subqueries were given names only after they were planned, which makes it difficult to use information from a previous execution of the query to guide future planning. If, for example, you knew something about how you want "InitPlan 2" to be planned, you won't know whether the subquery you're currently planning will end up being "InitPlan 2" until after you've finished planning it, by which point it's too late to use the information that you had. To fix this, assign each subplan a unique name before we begin planning it. To improve consistency, use textual names for all subplans, rather than, as we did previously, a mix of numbers (such as "InitPlan 1") and names (such as "CTE foo"), and make sure that the same name is never assigned more than once. We adopt the somewhat arbitrary convention of using the type of sublink to set the plan name; for example, a query that previously had two expression sublinks shown as InitPlan 2 and InitPlan 1 will now end up named expr_1 and expr_2. Because names are assigned before rather than after planning, some of the regression test outputs show the numerical part of the name switching positions: what was previously SubPlan 2 was actually the first one encountered, but we finished planning it later. We assign names even to subqueries that aren't shown as such within the EXPLAIN output. These include subqueries that are a FROM clause item or a branch of a set operation, rather than something that will be turned into an InitPlan or SubPlan. The purpose of this is to make sure that, below the topmost query level, there's always a name for each subquery that is stable from one planning cycle to the next (assuming no changes to the query or the database schema). Author: Robert Haas <rhaas@postgresql.org> Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com> Reviewed-by: Richard Guo <guofenglinux@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Junwang Zhao <zhjwpku@gmail.com> Discussion: http://postgr.es/m/3641043.1758751399@sss.pgh.pa.us
This commit is contained in:
@@ -3175,13 +3175,13 @@ select sum(c1) from ft1 group by c2 having avg(c1 * (random() <= 1)::int) > 100
|
|||||||
-- of an initplan) can be trouble, per bug #15781
|
-- of an initplan) can be trouble, per bug #15781
|
||||||
explain (verbose, costs off)
|
explain (verbose, costs off)
|
||||||
select exists(select 1 from pg_enum), sum(c1) from ft1;
|
select exists(select 1 from pg_enum), sum(c1) from ft1;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------
|
---------------------------------------------------
|
||||||
Foreign Scan
|
Foreign Scan
|
||||||
Output: (InitPlan 1).col1, (sum(ft1.c1))
|
Output: (InitPlan exists_1).col1, (sum(ft1.c1))
|
||||||
Relations: Aggregate on (public.ft1)
|
Relations: Aggregate on (public.ft1)
|
||||||
Remote SQL: SELECT sum("C 1") FROM "S 1"."T 1"
|
Remote SQL: SELECT sum("C 1") FROM "S 1"."T 1"
|
||||||
InitPlan 1
|
InitPlan exists_1
|
||||||
-> Seq Scan on pg_catalog.pg_enum
|
-> Seq Scan on pg_catalog.pg_enum
|
||||||
(6 rows)
|
(6 rows)
|
||||||
|
|
||||||
@@ -3196,8 +3196,8 @@ select exists(select 1 from pg_enum), sum(c1) from ft1 group by 1;
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
GroupAggregate
|
GroupAggregate
|
||||||
Output: (InitPlan 1).col1, sum(ft1.c1)
|
Output: (InitPlan exists_1).col1, sum(ft1.c1)
|
||||||
InitPlan 1
|
InitPlan exists_1
|
||||||
-> Seq Scan on pg_catalog.pg_enum
|
-> Seq Scan on pg_catalog.pg_enum
|
||||||
-> Foreign Scan on public.ft1
|
-> Foreign Scan on public.ft1
|
||||||
Output: ft1.c1
|
Output: ft1.c1
|
||||||
@@ -3356,15 +3356,15 @@ select distinct (select count(*) filter (where t2.c2 = 6 and t2.c1 < 10) from ft
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------
|
||||||
Unique
|
Unique
|
||||||
Output: ((SubPlan 1))
|
Output: ((SubPlan expr_1))
|
||||||
-> Sort
|
-> Sort
|
||||||
Output: ((SubPlan 1))
|
Output: ((SubPlan expr_1))
|
||||||
Sort Key: ((SubPlan 1))
|
Sort Key: ((SubPlan expr_1))
|
||||||
-> Foreign Scan
|
-> Foreign Scan
|
||||||
Output: (SubPlan 1)
|
Output: (SubPlan expr_1)
|
||||||
Relations: Aggregate on (public.ft2 t2)
|
Relations: Aggregate on (public.ft2 t2)
|
||||||
Remote SQL: SELECT count(*) FILTER (WHERE ((c2 = 6) AND ("C 1" < 10))) FROM "S 1"."T 1" WHERE (((c2 % 6) = 0))
|
Remote SQL: SELECT count(*) FILTER (WHERE ((c2 = 6) AND ("C 1" < 10))) FROM "S 1"."T 1" WHERE (((c2 % 6) = 0))
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Foreign Scan on public.ft1 t1
|
-> Foreign Scan on public.ft1 t1
|
||||||
Output: (count(*) FILTER (WHERE ((t2.c2 = 6) AND (t2.c1 < 10))))
|
Output: (count(*) FILTER (WHERE ((t2.c2 = 6) AND (t2.c1 < 10))))
|
||||||
Remote SQL: SELECT NULL FROM "S 1"."T 1" WHERE (("C 1" = 6))
|
Remote SQL: SELECT NULL FROM "S 1"."T 1" WHERE (("C 1" = 6))
|
||||||
@@ -3382,14 +3382,14 @@ select distinct (select count(t1.c1) filter (where t2.c2 = 6 and t2.c1 < 10) fro
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
Unique
|
Unique
|
||||||
Output: ((SubPlan 1))
|
Output: ((SubPlan expr_1))
|
||||||
-> Sort
|
-> Sort
|
||||||
Output: ((SubPlan 1))
|
Output: ((SubPlan expr_1))
|
||||||
Sort Key: ((SubPlan 1))
|
Sort Key: ((SubPlan expr_1))
|
||||||
-> Foreign Scan on public.ft2 t2
|
-> Foreign Scan on public.ft2 t2
|
||||||
Output: (SubPlan 1)
|
Output: (SubPlan expr_1)
|
||||||
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE (((c2 % 6) = 0))
|
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE (((c2 % 6) = 0))
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Foreign Scan
|
-> Foreign Scan
|
||||||
Output: (count(t1.c1) FILTER (WHERE ((t2.c2 = 6) AND (t2.c1 < 10))))
|
Output: (count(t1.c1) FILTER (WHERE ((t2.c2 = 6) AND (t2.c1 < 10))))
|
||||||
Relations: Aggregate on (public.ft1 t1)
|
Relations: Aggregate on (public.ft1 t1)
|
||||||
@@ -3421,14 +3421,14 @@ select sum(c1) filter (where (c1 / c1) * random() <= 1) from ft1 group by c2 ord
|
|||||||
|
|
||||||
explain (verbose, costs off)
|
explain (verbose, costs off)
|
||||||
select sum(c2) filter (where c2 in (select c2 from ft1 where c2 < 5)) from ft1;
|
select sum(c2) filter (where c2 in (select c2 from ft1 where c2 < 5)) from ft1;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------
|
||||||
Aggregate
|
Aggregate
|
||||||
Output: sum(ft1.c2) FILTER (WHERE (ANY (ft1.c2 = (hashed SubPlan 1).col1)))
|
Output: sum(ft1.c2) FILTER (WHERE (ANY (ft1.c2 = (hashed SubPlan any_1).col1)))
|
||||||
-> Foreign Scan on public.ft1
|
-> Foreign Scan on public.ft1
|
||||||
Output: ft1.c2
|
Output: ft1.c2
|
||||||
Remote SQL: SELECT c2 FROM "S 1"."T 1"
|
Remote SQL: SELECT c2 FROM "S 1"."T 1"
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Foreign Scan on public.ft1 ft1_1
|
-> Foreign Scan on public.ft1 ft1_1
|
||||||
Output: ft1_1.c2
|
Output: ft1_1.c2
|
||||||
Remote SQL: SELECT c2 FROM "S 1"."T 1" WHERE ((c2 < 5))
|
Remote SQL: SELECT c2 FROM "S 1"."T 1" WHERE ((c2 < 5))
|
||||||
@@ -6444,14 +6444,14 @@ UPDATE ft2 AS target SET (c2, c7) = (
|
|||||||
FROM ft2 AS src
|
FROM ft2 AS src
|
||||||
WHERE target.c1 = src.c1
|
WHERE target.c1 = src.c1
|
||||||
) WHERE c1 > 1100;
|
) WHERE c1 > 1100;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------
|
||||||
Update on public.ft2 target
|
Update on public.ft2 target
|
||||||
Remote SQL: UPDATE "S 1"."T 1" SET c2 = $2, c7 = $3 WHERE ctid = $1
|
Remote SQL: UPDATE "S 1"."T 1" SET c2 = $2, c7 = $3 WHERE ctid = $1
|
||||||
-> Foreign Scan on public.ft2 target
|
-> Foreign Scan on public.ft2 target
|
||||||
Output: (SubPlan 1).col1, (SubPlan 1).col2, (rescan SubPlan 1), target.ctid, target.*
|
Output: (SubPlan multiexpr_1).col1, (SubPlan multiexpr_1).col2, (rescan SubPlan multiexpr_1), target.ctid, target.*
|
||||||
Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8, ctid FROM "S 1"."T 1" WHERE (("C 1" > 1100)) FOR UPDATE
|
Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8, ctid FROM "S 1"."T 1" WHERE (("C 1" > 1100)) FOR UPDATE
|
||||||
SubPlan 1
|
SubPlan multiexpr_1
|
||||||
-> Foreign Scan on public.ft2 src
|
-> Foreign Scan on public.ft2 src
|
||||||
Output: (src.c2 * 10), src.c7
|
Output: (src.c2 * 10), src.c7
|
||||||
Remote SQL: SELECT c2, c7 FROM "S 1"."T 1" WHERE (($1::integer = "C 1"))
|
Remote SQL: SELECT c2, c7 FROM "S 1"."T 1" WHERE (($1::integer = "C 1"))
|
||||||
@@ -12132,12 +12132,12 @@ INSERT INTO local_tbl VALUES (1505, 505, 'foo');
|
|||||||
ANALYZE local_tbl;
|
ANALYZE local_tbl;
|
||||||
EXPLAIN (VERBOSE, COSTS OFF)
|
EXPLAIN (VERBOSE, COSTS OFF)
|
||||||
SELECT * FROM local_tbl t1 LEFT JOIN (SELECT *, (SELECT count(*) FROM async_pt WHERE a < 3000) FROM async_pt WHERE a < 3000) t2 ON t1.a = t2.a;
|
SELECT * FROM local_tbl t1 LEFT JOIN (SELECT *, (SELECT count(*) FROM async_pt WHERE a < 3000) FROM async_pt WHERE a < 3000) t2 ON t1.a = t2.a;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
Nested Loop Left Join
|
Nested Loop Left Join
|
||||||
Output: t1.a, t1.b, t1.c, async_pt.a, async_pt.b, async_pt.c, ((InitPlan 1).col1)
|
Output: t1.a, t1.b, t1.c, async_pt.a, async_pt.b, async_pt.c, ((InitPlan expr_1).col1)
|
||||||
Join Filter: (t1.a = async_pt.a)
|
Join Filter: (t1.a = async_pt.a)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Output: count(*)
|
Output: count(*)
|
||||||
-> Append
|
-> Append
|
||||||
@@ -12149,10 +12149,10 @@ SELECT * FROM local_tbl t1 LEFT JOIN (SELECT *, (SELECT count(*) FROM async_pt W
|
|||||||
Output: t1.a, t1.b, t1.c
|
Output: t1.a, t1.b, t1.c
|
||||||
-> Append
|
-> Append
|
||||||
-> Async Foreign Scan on public.async_p1 async_pt_1
|
-> Async Foreign Scan on public.async_p1 async_pt_1
|
||||||
Output: async_pt_1.a, async_pt_1.b, async_pt_1.c, (InitPlan 1).col1
|
Output: async_pt_1.a, async_pt_1.b, async_pt_1.c, (InitPlan expr_1).col1
|
||||||
Remote SQL: SELECT a, b, c FROM public.base_tbl1 WHERE ((a < 3000))
|
Remote SQL: SELECT a, b, c FROM public.base_tbl1 WHERE ((a < 3000))
|
||||||
-> Async Foreign Scan on public.async_p2 async_pt_2
|
-> Async Foreign Scan on public.async_p2 async_pt_2
|
||||||
Output: async_pt_2.a, async_pt_2.b, async_pt_2.c, (InitPlan 1).col1
|
Output: async_pt_2.a, async_pt_2.b, async_pt_2.c, (InitPlan expr_1).col1
|
||||||
Remote SQL: SELECT a, b, c FROM public.base_tbl2 WHERE ((a < 3000))
|
Remote SQL: SELECT a, b, c FROM public.base_tbl2 WHERE ((a < 3000))
|
||||||
(20 rows)
|
(20 rows)
|
||||||
|
|
||||||
@@ -12163,7 +12163,7 @@ SELECT * FROM local_tbl t1 LEFT JOIN (SELECT *, (SELECT count(*) FROM async_pt W
|
|||||||
Nested Loop Left Join (actual rows=1.00 loops=1)
|
Nested Loop Left Join (actual rows=1.00 loops=1)
|
||||||
Join Filter: (t1.a = async_pt.a)
|
Join Filter: (t1.a = async_pt.a)
|
||||||
Rows Removed by Join Filter: 399
|
Rows Removed by Join Filter: 399
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Aggregate (actual rows=1.00 loops=1)
|
-> Aggregate (actual rows=1.00 loops=1)
|
||||||
-> Append (actual rows=400.00 loops=1)
|
-> Append (actual rows=400.00 loops=1)
|
||||||
-> Async Foreign Scan on async_p1 async_pt_4 (actual rows=200.00 loops=1)
|
-> Async Foreign Scan on async_p1 async_pt_4 (actual rows=200.00 loops=1)
|
||||||
@@ -12386,12 +12386,12 @@ CREATE FOREIGN TABLE foreign_tbl2 () INHERITS (foreign_tbl)
|
|||||||
SERVER loopback OPTIONS (table_name 'base_tbl');
|
SERVER loopback OPTIONS (table_name 'base_tbl');
|
||||||
EXPLAIN (VERBOSE, COSTS OFF)
|
EXPLAIN (VERBOSE, COSTS OFF)
|
||||||
SELECT a FROM base_tbl WHERE (a, random() > 0) IN (SELECT a, random() > 0 FROM foreign_tbl);
|
SELECT a FROM base_tbl WHERE (a, random() > 0) IN (SELECT a, random() > 0 FROM foreign_tbl);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------
|
||||||
Seq Scan on public.base_tbl
|
Seq Scan on public.base_tbl
|
||||||
Output: base_tbl.a
|
Output: base_tbl.a
|
||||||
Filter: (ANY ((base_tbl.a = (SubPlan 1).col1) AND ((random() > '0'::double precision) = (SubPlan 1).col2)))
|
Filter: (ANY ((base_tbl.a = (SubPlan any_1).col1) AND ((random() > '0'::double precision) = (SubPlan any_1).col2)))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: base_tbl.a, (random() > '0'::double precision)
|
Output: base_tbl.a, (random() > '0'::double precision)
|
||||||
-> Append
|
-> Append
|
||||||
|
@@ -4901,6 +4901,7 @@ ExplainSubPlans(List *plans, List *ancestors,
|
|||||||
{
|
{
|
||||||
SubPlanState *sps = (SubPlanState *) lfirst(lst);
|
SubPlanState *sps = (SubPlanState *) lfirst(lst);
|
||||||
SubPlan *sp = sps->subplan;
|
SubPlan *sp = sps->subplan;
|
||||||
|
char *cooked_plan_name;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There can be multiple SubPlan nodes referencing the same physical
|
* There can be multiple SubPlan nodes referencing the same physical
|
||||||
@@ -4924,8 +4925,20 @@ ExplainSubPlans(List *plans, List *ancestors,
|
|||||||
*/
|
*/
|
||||||
ancestors = lcons(sp, ancestors);
|
ancestors = lcons(sp, ancestors);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The plan has a name like exists_1 or rowcompare_2, but here we want
|
||||||
|
* to prefix that with CTE, InitPlan, or SubPlan, as appropriate, for
|
||||||
|
* display purposes.
|
||||||
|
*/
|
||||||
|
if (sp->subLinkType == CTE_SUBLINK)
|
||||||
|
cooked_plan_name = psprintf("CTE %s", sp->plan_name);
|
||||||
|
else if (sp->isInitPlan)
|
||||||
|
cooked_plan_name = psprintf("InitPlan %s", sp->plan_name);
|
||||||
|
else
|
||||||
|
cooked_plan_name = psprintf("SubPlan %s", sp->plan_name);
|
||||||
|
|
||||||
ExplainNode(sps->planstate, ancestors,
|
ExplainNode(sps->planstate, ancestors,
|
||||||
relationship, sp->plan_name, es);
|
relationship, cooked_plan_name, es);
|
||||||
|
|
||||||
ancestors = list_delete_first(ancestors);
|
ancestors = list_delete_first(ancestors);
|
||||||
}
|
}
|
||||||
|
@@ -2529,6 +2529,7 @@ set_subquery_pathlist(PlannerInfo *root, RelOptInfo *rel,
|
|||||||
RelOptInfo *sub_final_rel;
|
RelOptInfo *sub_final_rel;
|
||||||
Bitmapset *run_cond_attrs = NULL;
|
Bitmapset *run_cond_attrs = NULL;
|
||||||
ListCell *lc;
|
ListCell *lc;
|
||||||
|
char *plan_name;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must copy the Query so that planning doesn't mess up the RTE contents
|
* Must copy the Query so that planning doesn't mess up the RTE contents
|
||||||
@@ -2671,8 +2672,9 @@ set_subquery_pathlist(PlannerInfo *root, RelOptInfo *rel,
|
|||||||
Assert(root->plan_params == NIL);
|
Assert(root->plan_params == NIL);
|
||||||
|
|
||||||
/* Generate a subroot and Paths for the subquery */
|
/* Generate a subroot and Paths for the subquery */
|
||||||
rel->subroot = subquery_planner(root->glob, subquery, root, false,
|
plan_name = choose_plan_name(root->glob, rte->eref->aliasname, false);
|
||||||
tuple_fraction, NULL);
|
rel->subroot = subquery_planner(root->glob, subquery, plan_name,
|
||||||
|
root, false, tuple_fraction, NULL);
|
||||||
|
|
||||||
/* Isolate the params needed by this specific subplan */
|
/* Isolate the params needed by this specific subplan */
|
||||||
rel->subplan_params = root->plan_params;
|
rel->subplan_params = root->plan_params;
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
#include "optimizer/pathnode.h"
|
#include "optimizer/pathnode.h"
|
||||||
#include "optimizer/paths.h"
|
#include "optimizer/paths.h"
|
||||||
#include "optimizer/planmain.h"
|
#include "optimizer/planmain.h"
|
||||||
|
#include "optimizer/planner.h"
|
||||||
#include "optimizer/subselect.h"
|
#include "optimizer/subselect.h"
|
||||||
#include "optimizer/tlist.h"
|
#include "optimizer/tlist.h"
|
||||||
#include "parser/parse_clause.h"
|
#include "parser/parse_clause.h"
|
||||||
@@ -339,6 +340,8 @@ build_minmax_path(PlannerInfo *root, MinMaxAggInfo *mminfo,
|
|||||||
memcpy(subroot, root, sizeof(PlannerInfo));
|
memcpy(subroot, root, sizeof(PlannerInfo));
|
||||||
subroot->query_level++;
|
subroot->query_level++;
|
||||||
subroot->parent_root = root;
|
subroot->parent_root = root;
|
||||||
|
subroot->plan_name = choose_plan_name(root->glob, "minmax", true);
|
||||||
|
|
||||||
/* reset subplan-related stuff */
|
/* reset subplan-related stuff */
|
||||||
subroot->plan_params = NIL;
|
subroot->plan_params = NIL;
|
||||||
subroot->outer_params = NULL;
|
subroot->outer_params = NULL;
|
||||||
|
@@ -439,7 +439,8 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* primary planning entry point (may recurse for subqueries) */
|
/* primary planning entry point (may recurse for subqueries) */
|
||||||
root = subquery_planner(glob, parse, NULL, false, tuple_fraction, NULL);
|
root = subquery_planner(glob, parse, NULL, NULL, false, tuple_fraction,
|
||||||
|
NULL);
|
||||||
|
|
||||||
/* Select best Path and turn it into a Plan */
|
/* Select best Path and turn it into a Plan */
|
||||||
final_rel = fetch_upper_rel(root, UPPERREL_FINAL, NULL);
|
final_rel = fetch_upper_rel(root, UPPERREL_FINAL, NULL);
|
||||||
@@ -630,6 +631,7 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
|
|||||||
*
|
*
|
||||||
* glob is the global state for the current planner run.
|
* glob is the global state for the current planner run.
|
||||||
* parse is the querytree produced by the parser & rewriter.
|
* parse is the querytree produced by the parser & rewriter.
|
||||||
|
* plan_name is the name to assign to this subplan (NULL at the top level).
|
||||||
* parent_root is the immediate parent Query's info (NULL at the top level).
|
* parent_root is the immediate parent Query's info (NULL at the top level).
|
||||||
* hasRecursion is true if this is a recursive WITH query.
|
* hasRecursion is true if this is a recursive WITH query.
|
||||||
* tuple_fraction is the fraction of tuples we expect will be retrieved.
|
* tuple_fraction is the fraction of tuples we expect will be retrieved.
|
||||||
@@ -656,9 +658,9 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
|
|||||||
*--------------------
|
*--------------------
|
||||||
*/
|
*/
|
||||||
PlannerInfo *
|
PlannerInfo *
|
||||||
subquery_planner(PlannerGlobal *glob, Query *parse, PlannerInfo *parent_root,
|
subquery_planner(PlannerGlobal *glob, Query *parse, char *plan_name,
|
||||||
bool hasRecursion, double tuple_fraction,
|
PlannerInfo *parent_root, bool hasRecursion,
|
||||||
SetOperationStmt *setops)
|
double tuple_fraction, SetOperationStmt *setops)
|
||||||
{
|
{
|
||||||
PlannerInfo *root;
|
PlannerInfo *root;
|
||||||
List *newWithCheckOptions;
|
List *newWithCheckOptions;
|
||||||
@@ -673,6 +675,7 @@ subquery_planner(PlannerGlobal *glob, Query *parse, PlannerInfo *parent_root,
|
|||||||
root->parse = parse;
|
root->parse = parse;
|
||||||
root->glob = glob;
|
root->glob = glob;
|
||||||
root->query_level = parent_root ? parent_root->query_level + 1 : 1;
|
root->query_level = parent_root ? parent_root->query_level + 1 : 1;
|
||||||
|
root->plan_name = plan_name;
|
||||||
root->parent_root = parent_root;
|
root->parent_root = parent_root;
|
||||||
root->plan_params = NIL;
|
root->plan_params = NIL;
|
||||||
root->outer_params = NULL;
|
root->outer_params = NULL;
|
||||||
@@ -8833,3 +8836,70 @@ create_partial_unique_paths(PlannerInfo *root, RelOptInfo *input_rel,
|
|||||||
sjinfo, unique_rel);
|
sjinfo, unique_rel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Choose a unique name for some subroot.
|
||||||
|
*
|
||||||
|
* Modifies glob->subplanNames to track names already used.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
choose_plan_name(PlannerGlobal *glob, const char *name, bool always_number)
|
||||||
|
{
|
||||||
|
unsigned n;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a numeric suffix is not required, then search the list of
|
||||||
|
* previously-assigned names for a match. If none is found, then we can
|
||||||
|
* use the provided name without modification.
|
||||||
|
*/
|
||||||
|
if (!always_number)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
foreach_ptr(char, subplan_name, glob->subplanNames)
|
||||||
|
{
|
||||||
|
if (strcmp(subplan_name, name) == 0)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
/* pstrdup here is just to avoid cast-away-const */
|
||||||
|
char *chosen_name = pstrdup(name);
|
||||||
|
|
||||||
|
glob->subplanNames = lappend(glob->subplanNames, chosen_name);
|
||||||
|
return chosen_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a numeric suffix is required or if the un-suffixed name is already
|
||||||
|
* in use, then loop until we find a positive integer that produces a
|
||||||
|
* novel name.
|
||||||
|
*/
|
||||||
|
for (n = 1; true; ++n)
|
||||||
|
{
|
||||||
|
char *proposed_name = psprintf("%s_%u", name, n);
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
foreach_ptr(char, subplan_name, glob->subplanNames)
|
||||||
|
{
|
||||||
|
if (strcmp(subplan_name, proposed_name) == 0)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
glob->subplanNames = lappend(glob->subplanNames, proposed_name);
|
||||||
|
return proposed_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
pfree(proposed_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -103,6 +103,7 @@ static Bitmapset *finalize_plan(PlannerInfo *root,
|
|||||||
Bitmapset *scan_params);
|
Bitmapset *scan_params);
|
||||||
static bool finalize_primnode(Node *node, finalize_primnode_context *context);
|
static bool finalize_primnode(Node *node, finalize_primnode_context *context);
|
||||||
static bool finalize_agg_primnode(Node *node, finalize_primnode_context *context);
|
static bool finalize_agg_primnode(Node *node, finalize_primnode_context *context);
|
||||||
|
static const char *sublinktype_to_string(SubLinkType subLinkType);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -172,6 +173,7 @@ make_subplan(PlannerInfo *root, Query *orig_subquery,
|
|||||||
Plan *plan;
|
Plan *plan;
|
||||||
List *plan_params;
|
List *plan_params;
|
||||||
Node *result;
|
Node *result;
|
||||||
|
const char *sublinkstr = sublinktype_to_string(subLinkType);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy the source Query node. This is a quick and dirty kluge to resolve
|
* Copy the source Query node. This is a quick and dirty kluge to resolve
|
||||||
@@ -218,8 +220,9 @@ make_subplan(PlannerInfo *root, Query *orig_subquery,
|
|||||||
Assert(root->plan_params == NIL);
|
Assert(root->plan_params == NIL);
|
||||||
|
|
||||||
/* Generate Paths for the subquery */
|
/* Generate Paths for the subquery */
|
||||||
subroot = subquery_planner(root->glob, subquery, root, false,
|
subroot = subquery_planner(root->glob, subquery,
|
||||||
tuple_fraction, NULL);
|
choose_plan_name(root->glob, sublinkstr, true),
|
||||||
|
root, false, tuple_fraction, NULL);
|
||||||
|
|
||||||
/* Isolate the params needed by this specific subplan */
|
/* Isolate the params needed by this specific subplan */
|
||||||
plan_params = root->plan_params;
|
plan_params = root->plan_params;
|
||||||
@@ -264,9 +267,12 @@ make_subplan(PlannerInfo *root, Query *orig_subquery,
|
|||||||
&newtestexpr, ¶mIds);
|
&newtestexpr, ¶mIds);
|
||||||
if (subquery)
|
if (subquery)
|
||||||
{
|
{
|
||||||
|
char *plan_name;
|
||||||
|
|
||||||
/* Generate Paths for the ANY subquery; we'll need all rows */
|
/* Generate Paths for the ANY subquery; we'll need all rows */
|
||||||
subroot = subquery_planner(root->glob, subquery, root, false, 0.0,
|
plan_name = choose_plan_name(root->glob, sublinkstr, true);
|
||||||
NULL);
|
subroot = subquery_planner(root->glob, subquery, plan_name,
|
||||||
|
root, false, 0.0, NULL);
|
||||||
|
|
||||||
/* Isolate the params needed by this specific subplan */
|
/* Isolate the params needed by this specific subplan */
|
||||||
plan_params = root->plan_params;
|
plan_params = root->plan_params;
|
||||||
@@ -324,15 +330,16 @@ build_subplan(PlannerInfo *root, Plan *plan, Path *path,
|
|||||||
{
|
{
|
||||||
Node *result;
|
Node *result;
|
||||||
SubPlan *splan;
|
SubPlan *splan;
|
||||||
bool isInitPlan;
|
|
||||||
ListCell *lc;
|
ListCell *lc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the SubPlan node. Note plan_id, plan_name, and cost fields
|
* Initialize the SubPlan node.
|
||||||
* are set further down.
|
*
|
||||||
|
* Note: plan_id and cost fields are set further down.
|
||||||
*/
|
*/
|
||||||
splan = makeNode(SubPlan);
|
splan = makeNode(SubPlan);
|
||||||
splan->subLinkType = subLinkType;
|
splan->subLinkType = subLinkType;
|
||||||
|
splan->plan_name = subroot->plan_name;
|
||||||
splan->testexpr = NULL;
|
splan->testexpr = NULL;
|
||||||
splan->paramIds = NIL;
|
splan->paramIds = NIL;
|
||||||
get_first_col_type(plan, &splan->firstColType, &splan->firstColTypmod,
|
get_first_col_type(plan, &splan->firstColType, &splan->firstColTypmod,
|
||||||
@@ -391,7 +398,7 @@ build_subplan(PlannerInfo *root, Plan *plan, Path *path,
|
|||||||
Assert(testexpr == NULL);
|
Assert(testexpr == NULL);
|
||||||
prm = generate_new_exec_param(root, BOOLOID, -1, InvalidOid);
|
prm = generate_new_exec_param(root, BOOLOID, -1, InvalidOid);
|
||||||
splan->setParam = list_make1_int(prm->paramid);
|
splan->setParam = list_make1_int(prm->paramid);
|
||||||
isInitPlan = true;
|
splan->isInitPlan = true;
|
||||||
result = (Node *) prm;
|
result = (Node *) prm;
|
||||||
}
|
}
|
||||||
else if (splan->parParam == NIL && subLinkType == EXPR_SUBLINK)
|
else if (splan->parParam == NIL && subLinkType == EXPR_SUBLINK)
|
||||||
@@ -406,7 +413,7 @@ build_subplan(PlannerInfo *root, Plan *plan, Path *path,
|
|||||||
exprTypmod((Node *) te->expr),
|
exprTypmod((Node *) te->expr),
|
||||||
exprCollation((Node *) te->expr));
|
exprCollation((Node *) te->expr));
|
||||||
splan->setParam = list_make1_int(prm->paramid);
|
splan->setParam = list_make1_int(prm->paramid);
|
||||||
isInitPlan = true;
|
splan->isInitPlan = true;
|
||||||
result = (Node *) prm;
|
result = (Node *) prm;
|
||||||
}
|
}
|
||||||
else if (splan->parParam == NIL && subLinkType == ARRAY_SUBLINK)
|
else if (splan->parParam == NIL && subLinkType == ARRAY_SUBLINK)
|
||||||
@@ -426,7 +433,7 @@ build_subplan(PlannerInfo *root, Plan *plan, Path *path,
|
|||||||
exprTypmod((Node *) te->expr),
|
exprTypmod((Node *) te->expr),
|
||||||
exprCollation((Node *) te->expr));
|
exprCollation((Node *) te->expr));
|
||||||
splan->setParam = list_make1_int(prm->paramid);
|
splan->setParam = list_make1_int(prm->paramid);
|
||||||
isInitPlan = true;
|
splan->isInitPlan = true;
|
||||||
result = (Node *) prm;
|
result = (Node *) prm;
|
||||||
}
|
}
|
||||||
else if (splan->parParam == NIL && subLinkType == ROWCOMPARE_SUBLINK)
|
else if (splan->parParam == NIL && subLinkType == ROWCOMPARE_SUBLINK)
|
||||||
@@ -442,7 +449,7 @@ build_subplan(PlannerInfo *root, Plan *plan, Path *path,
|
|||||||
testexpr,
|
testexpr,
|
||||||
params);
|
params);
|
||||||
splan->setParam = list_copy(splan->paramIds);
|
splan->setParam = list_copy(splan->paramIds);
|
||||||
isInitPlan = true;
|
splan->isInitPlan = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The executable expression is returned to become part of the outer
|
* The executable expression is returned to become part of the outer
|
||||||
@@ -476,12 +483,12 @@ build_subplan(PlannerInfo *root, Plan *plan, Path *path,
|
|||||||
/* It can be an initplan if there are no parParams. */
|
/* It can be an initplan if there are no parParams. */
|
||||||
if (splan->parParam == NIL)
|
if (splan->parParam == NIL)
|
||||||
{
|
{
|
||||||
isInitPlan = true;
|
splan->isInitPlan = true;
|
||||||
result = (Node *) makeNullConst(RECORDOID, -1, InvalidOid);
|
result = (Node *) makeNullConst(RECORDOID, -1, InvalidOid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isInitPlan = false;
|
splan->isInitPlan = false;
|
||||||
result = (Node *) splan;
|
result = (Node *) splan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -536,7 +543,7 @@ build_subplan(PlannerInfo *root, Plan *plan, Path *path,
|
|||||||
plan = materialize_finished_plan(plan);
|
plan = materialize_finished_plan(plan);
|
||||||
|
|
||||||
result = (Node *) splan;
|
result = (Node *) splan;
|
||||||
isInitPlan = false;
|
splan->isInitPlan = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -547,7 +554,7 @@ build_subplan(PlannerInfo *root, Plan *plan, Path *path,
|
|||||||
root->glob->subroots = lappend(root->glob->subroots, subroot);
|
root->glob->subroots = lappend(root->glob->subroots, subroot);
|
||||||
splan->plan_id = list_length(root->glob->subplans);
|
splan->plan_id = list_length(root->glob->subplans);
|
||||||
|
|
||||||
if (isInitPlan)
|
if (splan->isInitPlan)
|
||||||
root->init_plans = lappend(root->init_plans, splan);
|
root->init_plans = lappend(root->init_plans, splan);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -557,15 +564,10 @@ build_subplan(PlannerInfo *root, Plan *plan, Path *path,
|
|||||||
* there's no point since it won't get re-run without parameter changes
|
* there's no point since it won't get re-run without parameter changes
|
||||||
* anyway. The input of a hashed subplan doesn't need REWIND either.
|
* anyway. The input of a hashed subplan doesn't need REWIND either.
|
||||||
*/
|
*/
|
||||||
if (splan->parParam == NIL && !isInitPlan && !splan->useHashTable)
|
if (splan->parParam == NIL && !splan->isInitPlan && !splan->useHashTable)
|
||||||
root->glob->rewindPlanIDs = bms_add_member(root->glob->rewindPlanIDs,
|
root->glob->rewindPlanIDs = bms_add_member(root->glob->rewindPlanIDs,
|
||||||
splan->plan_id);
|
splan->plan_id);
|
||||||
|
|
||||||
/* Label the subplan for EXPLAIN purposes */
|
|
||||||
splan->plan_name = psprintf("%s %d",
|
|
||||||
isInitPlan ? "InitPlan" : "SubPlan",
|
|
||||||
splan->plan_id);
|
|
||||||
|
|
||||||
/* Lastly, fill in the cost estimates for use later */
|
/* Lastly, fill in the cost estimates for use later */
|
||||||
cost_subplan(root, splan, plan);
|
cost_subplan(root, splan, plan);
|
||||||
|
|
||||||
@@ -965,8 +967,9 @@ SS_process_ctes(PlannerInfo *root)
|
|||||||
* Generate Paths for the CTE query. Always plan for full retrieval
|
* Generate Paths for the CTE query. Always plan for full retrieval
|
||||||
* --- we don't have enough info to predict otherwise.
|
* --- we don't have enough info to predict otherwise.
|
||||||
*/
|
*/
|
||||||
subroot = subquery_planner(root->glob, subquery, root,
|
subroot = subquery_planner(root->glob, subquery,
|
||||||
cte->cterecursive, 0.0, NULL);
|
choose_plan_name(root->glob, cte->ctename, false),
|
||||||
|
root, cte->cterecursive, 0.0, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Since the current query level doesn't yet contain any RTEs, it
|
* Since the current query level doesn't yet contain any RTEs, it
|
||||||
@@ -989,10 +992,11 @@ SS_process_ctes(PlannerInfo *root)
|
|||||||
* Make a SubPlan node for it. This is just enough unlike
|
* Make a SubPlan node for it. This is just enough unlike
|
||||||
* build_subplan that we can't share code.
|
* build_subplan that we can't share code.
|
||||||
*
|
*
|
||||||
* Note plan_id, plan_name, and cost fields are set further down.
|
* Note: plan_id and cost fields are set further down.
|
||||||
*/
|
*/
|
||||||
splan = makeNode(SubPlan);
|
splan = makeNode(SubPlan);
|
||||||
splan->subLinkType = CTE_SUBLINK;
|
splan->subLinkType = CTE_SUBLINK;
|
||||||
|
splan->plan_name = subroot->plan_name;
|
||||||
splan->testexpr = NULL;
|
splan->testexpr = NULL;
|
||||||
splan->paramIds = NIL;
|
splan->paramIds = NIL;
|
||||||
get_first_col_type(plan, &splan->firstColType, &splan->firstColTypmod,
|
get_first_col_type(plan, &splan->firstColType, &splan->firstColTypmod,
|
||||||
@@ -1039,9 +1043,6 @@ SS_process_ctes(PlannerInfo *root)
|
|||||||
|
|
||||||
root->cte_plan_ids = lappend_int(root->cte_plan_ids, splan->plan_id);
|
root->cte_plan_ids = lappend_int(root->cte_plan_ids, splan->plan_id);
|
||||||
|
|
||||||
/* Label the subplan for EXPLAIN purposes */
|
|
||||||
splan->plan_name = psprintf("CTE %s", cte->ctename);
|
|
||||||
|
|
||||||
/* Lastly, fill in the cost estimates for use later */
|
/* Lastly, fill in the cost estimates for use later */
|
||||||
cost_subplan(root, splan, plan);
|
cost_subplan(root, splan, plan);
|
||||||
}
|
}
|
||||||
@@ -3185,7 +3186,8 @@ SS_make_initplan_from_plan(PlannerInfo *root,
|
|||||||
node = makeNode(SubPlan);
|
node = makeNode(SubPlan);
|
||||||
node->subLinkType = EXPR_SUBLINK;
|
node->subLinkType = EXPR_SUBLINK;
|
||||||
node->plan_id = list_length(root->glob->subplans);
|
node->plan_id = list_length(root->glob->subplans);
|
||||||
node->plan_name = psprintf("InitPlan %d", node->plan_id);
|
node->plan_name = subroot->plan_name;
|
||||||
|
node->isInitPlan = true;
|
||||||
get_first_col_type(plan, &node->firstColType, &node->firstColTypmod,
|
get_first_col_type(plan, &node->firstColType, &node->firstColTypmod,
|
||||||
&node->firstColCollation);
|
&node->firstColCollation);
|
||||||
node->parallel_safe = plan->parallel_safe;
|
node->parallel_safe = plan->parallel_safe;
|
||||||
@@ -3201,3 +3203,32 @@ SS_make_initplan_from_plan(PlannerInfo *root,
|
|||||||
/* Set costs of SubPlan using info from the plan tree */
|
/* Set costs of SubPlan using info from the plan tree */
|
||||||
cost_subplan(subroot, node, plan);
|
cost_subplan(subroot, node, plan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get a string equivalent of a given subLinkType.
|
||||||
|
*/
|
||||||
|
static const char *
|
||||||
|
sublinktype_to_string(SubLinkType subLinkType)
|
||||||
|
{
|
||||||
|
switch (subLinkType)
|
||||||
|
{
|
||||||
|
case EXISTS_SUBLINK:
|
||||||
|
return "exists";
|
||||||
|
case ALL_SUBLINK:
|
||||||
|
return "all";
|
||||||
|
case ANY_SUBLINK:
|
||||||
|
return "any";
|
||||||
|
case ROWCOMPARE_SUBLINK:
|
||||||
|
return "rowcompare";
|
||||||
|
case EXPR_SUBLINK:
|
||||||
|
return "expr";
|
||||||
|
case MULTIEXPR_SUBLINK:
|
||||||
|
return "multiexpr";
|
||||||
|
case ARRAY_SUBLINK:
|
||||||
|
return "array";
|
||||||
|
case CTE_SUBLINK:
|
||||||
|
return "cte";
|
||||||
|
}
|
||||||
|
Assert(false);
|
||||||
|
return "???";
|
||||||
|
}
|
||||||
|
@@ -1356,6 +1356,7 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte,
|
|||||||
subroot->parse = subquery;
|
subroot->parse = subquery;
|
||||||
subroot->glob = root->glob;
|
subroot->glob = root->glob;
|
||||||
subroot->query_level = root->query_level;
|
subroot->query_level = root->query_level;
|
||||||
|
subroot->plan_name = root->plan_name;
|
||||||
subroot->parent_root = root->parent_root;
|
subroot->parent_root = root->parent_root;
|
||||||
subroot->plan_params = NIL;
|
subroot->plan_params = NIL;
|
||||||
subroot->outer_params = NULL;
|
subroot->outer_params = NULL;
|
||||||
|
@@ -232,6 +232,7 @@ recurse_set_operations(Node *setOp, PlannerInfo *root,
|
|||||||
PlannerInfo *subroot;
|
PlannerInfo *subroot;
|
||||||
List *tlist;
|
List *tlist;
|
||||||
bool trivial_tlist;
|
bool trivial_tlist;
|
||||||
|
char *plan_name;
|
||||||
|
|
||||||
Assert(subquery != NULL);
|
Assert(subquery != NULL);
|
||||||
|
|
||||||
@@ -246,7 +247,9 @@ recurse_set_operations(Node *setOp, PlannerInfo *root,
|
|||||||
* parentOp, pass that down to encourage subquery_planner to consider
|
* parentOp, pass that down to encourage subquery_planner to consider
|
||||||
* suitably-sorted Paths.
|
* suitably-sorted Paths.
|
||||||
*/
|
*/
|
||||||
subroot = rel->subroot = subquery_planner(root->glob, subquery, root,
|
plan_name = choose_plan_name(root->glob, "setop", true);
|
||||||
|
subroot = rel->subroot = subquery_planner(root->glob, subquery,
|
||||||
|
plan_name, root,
|
||||||
false, root->tuple_fraction,
|
false, root->tuple_fraction,
|
||||||
parentOp);
|
parentOp);
|
||||||
|
|
||||||
|
@@ -8751,8 +8751,16 @@ get_parameter(Param *param, deparse_context *context)
|
|||||||
subplan = find_param_generator(param, context, &column);
|
subplan = find_param_generator(param, context, &column);
|
||||||
if (subplan)
|
if (subplan)
|
||||||
{
|
{
|
||||||
appendStringInfo(context->buf, "(%s%s).col%d",
|
const char *nameprefix;
|
||||||
|
|
||||||
|
if (subplan->isInitPlan)
|
||||||
|
nameprefix = "InitPlan ";
|
||||||
|
else
|
||||||
|
nameprefix = "SubPlan ";
|
||||||
|
|
||||||
|
appendStringInfo(context->buf, "(%s%s%s).col%d",
|
||||||
subplan->useHashTable ? "hashed " : "",
|
subplan->useHashTable ? "hashed " : "",
|
||||||
|
nameprefix,
|
||||||
subplan->plan_name, column + 1);
|
subplan->plan_name, column + 1);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -9589,11 +9597,19 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const char *nameprefix;
|
||||||
|
|
||||||
/* No referencing Params, so show the SubPlan's name */
|
/* No referencing Params, so show the SubPlan's name */
|
||||||
if (subplan->useHashTable)
|
if (subplan->isInitPlan)
|
||||||
appendStringInfo(buf, "hashed %s)", subplan->plan_name);
|
nameprefix = "InitPlan ";
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "%s)", subplan->plan_name);
|
nameprefix = "SubPlan ";
|
||||||
|
if (subplan->useHashTable)
|
||||||
|
appendStringInfo(buf, "hashed %s%s)",
|
||||||
|
nameprefix, subplan->plan_name);
|
||||||
|
else
|
||||||
|
appendStringInfo(buf, "%s%s)",
|
||||||
|
nameprefix, subplan->plan_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -9613,11 +9629,18 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
foreach(lc, asplan->subplans)
|
foreach(lc, asplan->subplans)
|
||||||
{
|
{
|
||||||
SubPlan *splan = lfirst_node(SubPlan, lc);
|
SubPlan *splan = lfirst_node(SubPlan, lc);
|
||||||
|
const char *nameprefix;
|
||||||
|
|
||||||
if (splan->useHashTable)
|
if (splan->isInitPlan)
|
||||||
appendStringInfo(buf, "hashed %s", splan->plan_name);
|
nameprefix = "InitPlan ";
|
||||||
else
|
else
|
||||||
appendStringInfoString(buf, splan->plan_name);
|
nameprefix = "SubPlan ";
|
||||||
|
if (splan->useHashTable)
|
||||||
|
appendStringInfo(buf, "hashed %s%s", nameprefix,
|
||||||
|
splan->plan_name);
|
||||||
|
else
|
||||||
|
appendStringInfo(buf, "%s%s", nameprefix,
|
||||||
|
splan->plan_name);
|
||||||
if (lnext(asplan->subplans, lc))
|
if (lnext(asplan->subplans, lc))
|
||||||
appendStringInfoString(buf, " or ");
|
appendStringInfoString(buf, " or ");
|
||||||
}
|
}
|
||||||
|
@@ -110,6 +110,9 @@ typedef struct PlannerGlobal
|
|||||||
/* PlannerInfos for SubPlan nodes */
|
/* PlannerInfos for SubPlan nodes */
|
||||||
List *subroots pg_node_attr(read_write_ignore);
|
List *subroots pg_node_attr(read_write_ignore);
|
||||||
|
|
||||||
|
/* names already used for subplans (list of C strings) */
|
||||||
|
List *subplanNames pg_node_attr(read_write_ignore);
|
||||||
|
|
||||||
/* indices of subplans that require REWIND */
|
/* indices of subplans that require REWIND */
|
||||||
Bitmapset *rewindPlanIDs;
|
Bitmapset *rewindPlanIDs;
|
||||||
|
|
||||||
@@ -228,6 +231,9 @@ struct PlannerInfo
|
|||||||
/* NULL at outermost Query */
|
/* NULL at outermost Query */
|
||||||
PlannerInfo *parent_root pg_node_attr(read_write_ignore);
|
PlannerInfo *parent_root pg_node_attr(read_write_ignore);
|
||||||
|
|
||||||
|
/* Subplan name for EXPLAIN and debugging purposes (NULL at top level) */
|
||||||
|
char *plan_name;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* plan_params contains the expressions that this query level needs to
|
* plan_params contains the expressions that this query level needs to
|
||||||
* make available to a lower query level that is currently being planned.
|
* make available to a lower query level that is currently being planned.
|
||||||
|
@@ -1108,6 +1108,7 @@ typedef struct SubPlan
|
|||||||
Oid firstColCollation; /* Collation of first column of subplan
|
Oid firstColCollation; /* Collation of first column of subplan
|
||||||
* result */
|
* result */
|
||||||
/* Information about execution strategy: */
|
/* Information about execution strategy: */
|
||||||
|
bool isInitPlan; /* true if it's an InitPlan */
|
||||||
bool useHashTable; /* true to store subselect output in a hash
|
bool useHashTable; /* true to store subselect output in a hash
|
||||||
* table (implies we are doing "IN") */
|
* table (implies we are doing "IN") */
|
||||||
bool unknownEqFalse; /* true if it's okay to return FALSE when the
|
bool unknownEqFalse; /* true if it's okay to return FALSE when the
|
||||||
|
@@ -43,6 +43,7 @@ extern PlannedStmt *standard_planner(Query *parse, const char *query_string,
|
|||||||
ParamListInfo boundParams);
|
ParamListInfo boundParams);
|
||||||
|
|
||||||
extern PlannerInfo *subquery_planner(PlannerGlobal *glob, Query *parse,
|
extern PlannerInfo *subquery_planner(PlannerGlobal *glob, Query *parse,
|
||||||
|
char *plan_name,
|
||||||
PlannerInfo *parent_root,
|
PlannerInfo *parent_root,
|
||||||
bool hasRecursion, double tuple_fraction,
|
bool hasRecursion, double tuple_fraction,
|
||||||
SetOperationStmt *setops);
|
SetOperationStmt *setops);
|
||||||
@@ -62,4 +63,7 @@ extern Expr *preprocess_phv_expression(PlannerInfo *root, Expr *expr);
|
|||||||
extern RelOptInfo *create_unique_paths(PlannerInfo *root, RelOptInfo *rel,
|
extern RelOptInfo *create_unique_paths(PlannerInfo *root, RelOptInfo *rel,
|
||||||
SpecialJoinInfo *sjinfo);
|
SpecialJoinInfo *sjinfo);
|
||||||
|
|
||||||
|
extern char *choose_plan_name(PlannerGlobal *glob, const char *name,
|
||||||
|
bool always_number);
|
||||||
|
|
||||||
#endif /* PLANNER_H */
|
#endif /* PLANNER_H */
|
||||||
|
@@ -782,9 +782,9 @@ select array(select sum(x+y) s
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Function Scan on pg_catalog.generate_series x
|
Function Scan on pg_catalog.generate_series x
|
||||||
Output: ARRAY(SubPlan 1)
|
Output: ARRAY(SubPlan array_1)
|
||||||
Function Call: generate_series(1, 3)
|
Function Call: generate_series(1, 3)
|
||||||
SubPlan 1
|
SubPlan array_1
|
||||||
-> Sort
|
-> Sort
|
||||||
Output: (sum((x.x + y.y))), y.y
|
Output: (sum((x.x + y.y))), y.y
|
||||||
Sort Key: (sum((x.x + y.y)))
|
Sort Key: (sum((x.x + y.y)))
|
||||||
@@ -960,7 +960,7 @@ explain (costs off)
|
|||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan using tenk1_unique1 on tenk1
|
-> Index Only Scan using tenk1_unique1 on tenk1
|
||||||
Index Cond: (unique1 IS NOT NULL)
|
Index Cond: (unique1 IS NOT NULL)
|
||||||
@@ -978,7 +978,7 @@ explain (costs off)
|
|||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan Backward using tenk1_unique1 on tenk1
|
-> Index Only Scan Backward using tenk1_unique1 on tenk1
|
||||||
Index Cond: (unique1 IS NOT NULL)
|
Index Cond: (unique1 IS NOT NULL)
|
||||||
@@ -996,7 +996,7 @@ explain (costs off)
|
|||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan Backward using tenk1_unique1 on tenk1
|
-> Index Only Scan Backward using tenk1_unique1 on tenk1
|
||||||
Index Cond: ((unique1 IS NOT NULL) AND (unique1 < 42))
|
Index Cond: ((unique1 IS NOT NULL) AND (unique1 < 42))
|
||||||
@@ -1014,7 +1014,7 @@ explain (costs off)
|
|||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan Backward using tenk1_unique1 on tenk1
|
-> Index Only Scan Backward using tenk1_unique1 on tenk1
|
||||||
Index Cond: ((unique1 IS NOT NULL) AND (unique1 > 42))
|
Index Cond: ((unique1 IS NOT NULL) AND (unique1 > 42))
|
||||||
@@ -1038,7 +1038,7 @@ explain (costs off)
|
|||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan Backward using tenk1_unique1 on tenk1
|
-> Index Only Scan Backward using tenk1_unique1 on tenk1
|
||||||
Index Cond: ((unique1 IS NOT NULL) AND (unique1 > 42000))
|
Index Cond: ((unique1 IS NOT NULL) AND (unique1 > 42000))
|
||||||
@@ -1058,7 +1058,7 @@ explain (costs off)
|
|||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan Backward using tenk1_thous_tenthous on tenk1
|
-> Index Only Scan Backward using tenk1_thous_tenthous on tenk1
|
||||||
Index Cond: ((thousand = 33) AND (tenthous IS NOT NULL))
|
Index Cond: ((thousand = 33) AND (tenthous IS NOT NULL))
|
||||||
@@ -1076,7 +1076,7 @@ explain (costs off)
|
|||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan using tenk1_thous_tenthous on tenk1
|
-> Index Only Scan using tenk1_thous_tenthous on tenk1
|
||||||
Index Cond: ((thousand = 33) AND (tenthous IS NOT NULL))
|
Index Cond: ((thousand = 33) AND (tenthous IS NOT NULL))
|
||||||
@@ -1095,10 +1095,10 @@ explain (costs off)
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------
|
||||||
Seq Scan on int4_tbl
|
Seq Scan on int4_tbl
|
||||||
SubPlan 2
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan using tenk1_unique1 on tenk1
|
-> Index Only Scan using tenk1_unique1 on tenk1
|
||||||
Index Cond: ((unique1 IS NOT NULL) AND (unique1 > int4_tbl.f1))
|
Index Cond: ((unique1 IS NOT NULL) AND (unique1 > int4_tbl.f1))
|
||||||
@@ -1121,8 +1121,8 @@ explain (costs off)
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
HashAggregate
|
HashAggregate
|
||||||
Group Key: (InitPlan 1).col1
|
Group Key: (InitPlan minmax_1).col1
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan Backward using tenk1_unique2 on tenk1
|
-> Index Only Scan Backward using tenk1_unique2 on tenk1
|
||||||
Index Cond: (unique2 IS NOT NULL)
|
Index Cond: (unique2 IS NOT NULL)
|
||||||
@@ -1141,8 +1141,8 @@ explain (costs off)
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Sort
|
Sort
|
||||||
Sort Key: ((InitPlan 1).col1)
|
Sort Key: ((InitPlan minmax_1).col1)
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan Backward using tenk1_unique2 on tenk1
|
-> Index Only Scan Backward using tenk1_unique2 on tenk1
|
||||||
Index Cond: (unique2 IS NOT NULL)
|
Index Cond: (unique2 IS NOT NULL)
|
||||||
@@ -1161,8 +1161,8 @@ explain (costs off)
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Sort
|
Sort
|
||||||
Sort Key: ((InitPlan 1).col1)
|
Sort Key: ((InitPlan minmax_1).col1)
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan Backward using tenk1_unique2 on tenk1
|
-> Index Only Scan Backward using tenk1_unique2 on tenk1
|
||||||
Index Cond: (unique2 IS NOT NULL)
|
Index Cond: (unique2 IS NOT NULL)
|
||||||
@@ -1181,8 +1181,8 @@ explain (costs off)
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Sort
|
Sort
|
||||||
Sort Key: (((InitPlan 1).col1 + 1))
|
Sort Key: (((InitPlan minmax_1).col1 + 1))
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan Backward using tenk1_unique2 on tenk1
|
-> Index Only Scan Backward using tenk1_unique2 on tenk1
|
||||||
Index Cond: (unique2 IS NOT NULL)
|
Index Cond: (unique2 IS NOT NULL)
|
||||||
@@ -1202,7 +1202,7 @@ explain (costs off)
|
|||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Sort
|
Sort
|
||||||
Sort Key: (generate_series(1, 3)) DESC
|
Sort Key: (generate_series(1, 3)) DESC
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan Backward using tenk1_unique2 on tenk1
|
-> Index Only Scan Backward using tenk1_unique2 on tenk1
|
||||||
Index Cond: (unique2 IS NOT NULL)
|
Index Cond: (unique2 IS NOT NULL)
|
||||||
@@ -1226,7 +1226,7 @@ explain (costs off)
|
|||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Result
|
-> Result
|
||||||
One-Time Filter: (100 IS NOT NULL)
|
One-Time Filter: (100 IS NOT NULL)
|
||||||
@@ -1258,7 +1258,7 @@ explain (costs off)
|
|||||||
---------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Merge Append
|
-> Merge Append
|
||||||
Sort Key: minmaxtest.f1
|
Sort Key: minmaxtest.f1
|
||||||
@@ -1269,7 +1269,7 @@ explain (costs off)
|
|||||||
-> Index Only Scan Backward using minmaxtest2i on minmaxtest2 minmaxtest_3
|
-> Index Only Scan Backward using minmaxtest2i on minmaxtest2 minmaxtest_3
|
||||||
Index Cond: (f1 IS NOT NULL)
|
Index Cond: (f1 IS NOT NULL)
|
||||||
-> Index Only Scan using minmaxtest3i on minmaxtest3 minmaxtest_4
|
-> Index Only Scan using minmaxtest3i on minmaxtest3 minmaxtest_4
|
||||||
InitPlan 2
|
InitPlan minmax_2
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Merge Append
|
-> Merge Append
|
||||||
Sort Key: minmaxtest_5.f1 DESC
|
Sort Key: minmaxtest_5.f1 DESC
|
||||||
@@ -1294,7 +1294,7 @@ explain (costs off)
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------
|
||||||
Unique
|
Unique
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Merge Append
|
-> Merge Append
|
||||||
Sort Key: minmaxtest.f1
|
Sort Key: minmaxtest.f1
|
||||||
@@ -1305,7 +1305,7 @@ explain (costs off)
|
|||||||
-> Index Only Scan Backward using minmaxtest2i on minmaxtest2 minmaxtest_3
|
-> Index Only Scan Backward using minmaxtest2i on minmaxtest2 minmaxtest_3
|
||||||
Index Cond: (f1 IS NOT NULL)
|
Index Cond: (f1 IS NOT NULL)
|
||||||
-> Index Only Scan using minmaxtest3i on minmaxtest3 minmaxtest_4
|
-> Index Only Scan using minmaxtest3i on minmaxtest3 minmaxtest_4
|
||||||
InitPlan 2
|
InitPlan minmax_2
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Merge Append
|
-> Merge Append
|
||||||
Sort Key: minmaxtest_5.f1 DESC
|
Sort Key: minmaxtest_5.f1 DESC
|
||||||
@@ -1317,7 +1317,7 @@ explain (costs off)
|
|||||||
Index Cond: (f1 IS NOT NULL)
|
Index Cond: (f1 IS NOT NULL)
|
||||||
-> Index Only Scan Backward using minmaxtest3i on minmaxtest3 minmaxtest_9
|
-> Index Only Scan Backward using minmaxtest3i on minmaxtest3 minmaxtest_9
|
||||||
-> Sort
|
-> Sort
|
||||||
Sort Key: ((InitPlan 1).col1), ((InitPlan 2).col1)
|
Sort Key: ((InitPlan minmax_1).col1), ((InitPlan minmax_2).col1)
|
||||||
-> Result
|
-> Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
(27 rows)
|
(27 rows)
|
||||||
@@ -1342,10 +1342,10 @@ explain (costs off)
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Seq Scan on int4_tbl t0
|
Seq Scan on int4_tbl t0
|
||||||
SubPlan 2
|
SubPlan expr_1
|
||||||
-> HashAggregate
|
-> HashAggregate
|
||||||
Group Key: (InitPlan 1).col1
|
Group Key: (InitPlan minmax_1).col1
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Seq Scan on int4_tbl t1
|
-> Seq Scan on int4_tbl t1
|
||||||
Filter: ((f1 IS NOT NULL) AND (f1 = t0.f1))
|
Filter: ((f1 IS NOT NULL) AND (f1 = t0.f1))
|
||||||
|
@@ -593,7 +593,7 @@ SELECT point(x,x), (SELECT f1 FROM gpolygon_tbl ORDER BY f1 <-> point(x,x) LIMIT
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------
|
||||||
Function Scan on generate_series x
|
Function Scan on generate_series x
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Scan using ggpolygonind on gpolygon_tbl
|
-> Index Scan using ggpolygonind on gpolygon_tbl
|
||||||
Order By: (f1 <-> point((x.x)::double precision, (x.x)::double precision))
|
Order By: (f1 <-> point((x.x)::double precision, (x.x)::double precision))
|
||||||
@@ -1908,11 +1908,11 @@ SELECT * FROM tenk1
|
|||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
SELECT * FROM tenk1
|
SELECT * FROM tenk1
|
||||||
WHERE thousand = 42 AND (tenthous = 1 OR tenthous = (SELECT 1 + 2) OR tenthous = 42);
|
WHERE thousand = 42 AND (tenthous = 1 OR tenthous = (SELECT 1 + 2) OR tenthous = 42);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------
|
||||||
Index Scan using tenk1_thous_tenthous on tenk1
|
Index Scan using tenk1_thous_tenthous on tenk1
|
||||||
Index Cond: ((thousand = 42) AND (tenthous = ANY (ARRAY[1, (InitPlan 1).col1, 42])))
|
Index Cond: ((thousand = 42) AND (tenthous = ANY (ARRAY[1, (InitPlan expr_1).col1, 42])))
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
@@ -2043,8 +2043,8 @@ SELECT count(*) FROM tenk1 t1
|
|||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
Aggregate
|
Aggregate
|
||||||
-> Index Only Scan using tenk1_thous_tenthous on tenk1 t1
|
-> Index Only Scan using tenk1_thous_tenthous on tenk1 t1
|
||||||
Filter: ((thousand = 42) OR (thousand = (SubPlan 1)))
|
Filter: ((thousand = 42) OR (thousand = (SubPlan expr_1)))
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan using tenk1_thous_tenthous on tenk1 t2
|
-> Index Only Scan using tenk1_thous_tenthous on tenk1 t2
|
||||||
Index Cond: (thousand = (t1.tenthous + 1))
|
Index Cond: (thousand = (t1.tenthous + 1))
|
||||||
|
@@ -504,17 +504,17 @@ select grouping(ss.x)
|
|||||||
from int8_tbl i1
|
from int8_tbl i1
|
||||||
cross join lateral (select (select i1.q1) as x) ss
|
cross join lateral (select (select i1.q1) as x) ss
|
||||||
group by ss.x;
|
group by ss.x;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
------------------------------------------------
|
----------------------------------------------------------
|
||||||
GroupAggregate
|
GroupAggregate
|
||||||
Output: GROUPING((SubPlan 1)), ((SubPlan 2))
|
Output: GROUPING((SubPlan expr_1)), ((SubPlan expr_2))
|
||||||
Group Key: ((SubPlan 2))
|
Group Key: ((SubPlan expr_2))
|
||||||
-> Sort
|
-> Sort
|
||||||
Output: ((SubPlan 2)), i1.q1
|
Output: ((SubPlan expr_2)), i1.q1
|
||||||
Sort Key: ((SubPlan 2))
|
Sort Key: ((SubPlan expr_2))
|
||||||
-> Seq Scan on public.int8_tbl i1
|
-> Seq Scan on public.int8_tbl i1
|
||||||
Output: (SubPlan 2), i1.q1
|
Output: (SubPlan expr_2), i1.q1
|
||||||
SubPlan 2
|
SubPlan expr_2
|
||||||
-> Result
|
-> Result
|
||||||
Output: i1.q1
|
Output: i1.q1
|
||||||
(11 rows)
|
(11 rows)
|
||||||
@@ -534,22 +534,22 @@ select (select grouping(ss.x))
|
|||||||
from int8_tbl i1
|
from int8_tbl i1
|
||||||
cross join lateral (select (select i1.q1) as x) ss
|
cross join lateral (select (select i1.q1) as x) ss
|
||||||
group by ss.x;
|
group by ss.x;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------
|
------------------------------------------------
|
||||||
GroupAggregate
|
GroupAggregate
|
||||||
Output: (SubPlan 2), ((SubPlan 3))
|
Output: (SubPlan expr_1), ((SubPlan expr_3))
|
||||||
Group Key: ((SubPlan 3))
|
Group Key: ((SubPlan expr_3))
|
||||||
-> Sort
|
-> Sort
|
||||||
Output: ((SubPlan 3)), i1.q1
|
Output: ((SubPlan expr_3)), i1.q1
|
||||||
Sort Key: ((SubPlan 3))
|
Sort Key: ((SubPlan expr_3))
|
||||||
-> Seq Scan on public.int8_tbl i1
|
-> Seq Scan on public.int8_tbl i1
|
||||||
Output: (SubPlan 3), i1.q1
|
Output: (SubPlan expr_3), i1.q1
|
||||||
SubPlan 3
|
SubPlan expr_3
|
||||||
-> Result
|
-> Result
|
||||||
Output: i1.q1
|
Output: i1.q1
|
||||||
SubPlan 2
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: GROUPING((SubPlan 1))
|
Output: GROUPING((SubPlan expr_2))
|
||||||
(14 rows)
|
(14 rows)
|
||||||
|
|
||||||
select (select grouping(ss.x))
|
select (select grouping(ss.x))
|
||||||
@@ -592,7 +592,7 @@ explain (costs off)
|
|||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan using tenk1_unique1 on tenk1
|
-> Index Only Scan using tenk1_unique1 on tenk1
|
||||||
Index Cond: (unique1 IS NOT NULL)
|
Index Cond: (unique1 IS NOT NULL)
|
||||||
@@ -881,7 +881,7 @@ explain (costs off)
|
|||||||
Sort
|
Sort
|
||||||
Sort Key: "*VALUES*".column1
|
Sort Key: "*VALUES*".column1
|
||||||
-> Values Scan on "*VALUES*"
|
-> Values Scan on "*VALUES*"
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Group Key: ()
|
Group Key: ()
|
||||||
Filter: "*VALUES*".column1
|
Filter: "*VALUES*".column1
|
||||||
@@ -2169,17 +2169,17 @@ order by a, b, c;
|
|||||||
-- test handling of outer GroupingFunc within subqueries
|
-- test handling of outer GroupingFunc within subqueries
|
||||||
explain (costs off)
|
explain (costs off)
|
||||||
select (select grouping(v1)) from (values ((select 1))) v(v1) group by cube(v1);
|
select (select grouping(v1)) from (values ((select 1))) v(v1) group by cube(v1);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-------------------------------
|
------------------------------------
|
||||||
MixedAggregate
|
MixedAggregate
|
||||||
Hash Key: (InitPlan 3).col1
|
Hash Key: (InitPlan expr_3).col1
|
||||||
Group Key: ()
|
Group Key: ()
|
||||||
InitPlan 1
|
InitPlan expr_2
|
||||||
-> Result
|
-> Result
|
||||||
InitPlan 3
|
InitPlan expr_3
|
||||||
-> Result
|
-> Result
|
||||||
-> Result
|
-> Result
|
||||||
SubPlan 2
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
@@ -2192,15 +2192,15 @@ select (select grouping(v1)) from (values ((select 1))) v(v1) group by cube(v1);
|
|||||||
|
|
||||||
explain (costs off)
|
explain (costs off)
|
||||||
select (select grouping(v1)) from (values ((select 1))) v(v1) group by v1;
|
select (select grouping(v1)) from (values ((select 1))) v(v1) group by v1;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------
|
-------------------
|
||||||
GroupAggregate
|
GroupAggregate
|
||||||
InitPlan 1
|
InitPlan expr_2
|
||||||
-> Result
|
-> Result
|
||||||
InitPlan 3
|
InitPlan expr_3
|
||||||
-> Result
|
-> Result
|
||||||
-> Result
|
-> Result
|
||||||
SubPlan 2
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
(8 rows)
|
(8 rows)
|
||||||
|
|
||||||
@@ -2222,18 +2222,18 @@ order by case when grouping((select t1.v from gstest5 t2 where id = t1.id)) = 0
|
|||||||
then (select t1.v from gstest5 t2 where id = t1.id)
|
then (select t1.v from gstest5 t2 where id = t1.id)
|
||||||
else null end
|
else null end
|
||||||
nulls first;
|
nulls first;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
Sort
|
Sort
|
||||||
Output: (GROUPING((SubPlan 1))), ((SubPlan 3)), (CASE WHEN (GROUPING((SubPlan 2)) = 0) THEN ((SubPlan 3)) ELSE NULL::integer END), t1.v
|
Output: (GROUPING((SubPlan expr_1))), ((SubPlan expr_3)), (CASE WHEN (GROUPING((SubPlan expr_2)) = 0) THEN ((SubPlan expr_3)) ELSE NULL::integer END), t1.v
|
||||||
Sort Key: (CASE WHEN (GROUPING((SubPlan 2)) = 0) THEN ((SubPlan 3)) ELSE NULL::integer END) NULLS FIRST
|
Sort Key: (CASE WHEN (GROUPING((SubPlan expr_2)) = 0) THEN ((SubPlan expr_3)) ELSE NULL::integer END) NULLS FIRST
|
||||||
-> HashAggregate
|
-> HashAggregate
|
||||||
Output: GROUPING((SubPlan 1)), ((SubPlan 3)), CASE WHEN (GROUPING((SubPlan 2)) = 0) THEN ((SubPlan 3)) ELSE NULL::integer END, t1.v
|
Output: GROUPING((SubPlan expr_1)), ((SubPlan expr_3)), CASE WHEN (GROUPING((SubPlan expr_2)) = 0) THEN ((SubPlan expr_3)) ELSE NULL::integer END, t1.v
|
||||||
Hash Key: t1.v
|
Hash Key: t1.v
|
||||||
Hash Key: (SubPlan 3)
|
Hash Key: (SubPlan expr_3)
|
||||||
-> Seq Scan on pg_temp.gstest5 t1
|
-> Seq Scan on pg_temp.gstest5 t1
|
||||||
Output: (SubPlan 3), t1.v, t1.id
|
Output: (SubPlan expr_3), t1.v, t1.id
|
||||||
SubPlan 3
|
SubPlan expr_3
|
||||||
-> Bitmap Heap Scan on pg_temp.gstest5 t2
|
-> Bitmap Heap Scan on pg_temp.gstest5 t2
|
||||||
Output: t1.v
|
Output: t1.v
|
||||||
Recheck Cond: (t2.id = t1.id)
|
Recheck Cond: (t2.id = t1.id)
|
||||||
@@ -2272,18 +2272,18 @@ select grouping((select t1.v from gstest5 t2 where id = t1.id)),
|
|||||||
from gstest5 t1
|
from gstest5 t1
|
||||||
group by grouping sets(v, s)
|
group by grouping sets(v, s)
|
||||||
order by o nulls first;
|
order by o nulls first;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
Sort
|
Sort
|
||||||
Output: (GROUPING((SubPlan 1))), ((SubPlan 3)), (CASE WHEN (GROUPING((SubPlan 2)) = 0) THEN ((SubPlan 3)) ELSE NULL::integer END), t1.v
|
Output: (GROUPING((SubPlan expr_1))), ((SubPlan expr_3)), (CASE WHEN (GROUPING((SubPlan expr_2)) = 0) THEN ((SubPlan expr_3)) ELSE NULL::integer END), t1.v
|
||||||
Sort Key: (CASE WHEN (GROUPING((SubPlan 2)) = 0) THEN ((SubPlan 3)) ELSE NULL::integer END) NULLS FIRST
|
Sort Key: (CASE WHEN (GROUPING((SubPlan expr_2)) = 0) THEN ((SubPlan expr_3)) ELSE NULL::integer END) NULLS FIRST
|
||||||
-> HashAggregate
|
-> HashAggregate
|
||||||
Output: GROUPING((SubPlan 1)), ((SubPlan 3)), CASE WHEN (GROUPING((SubPlan 2)) = 0) THEN ((SubPlan 3)) ELSE NULL::integer END, t1.v
|
Output: GROUPING((SubPlan expr_1)), ((SubPlan expr_3)), CASE WHEN (GROUPING((SubPlan expr_2)) = 0) THEN ((SubPlan expr_3)) ELSE NULL::integer END, t1.v
|
||||||
Hash Key: t1.v
|
Hash Key: t1.v
|
||||||
Hash Key: (SubPlan 3)
|
Hash Key: (SubPlan expr_3)
|
||||||
-> Seq Scan on pg_temp.gstest5 t1
|
-> Seq Scan on pg_temp.gstest5 t1
|
||||||
Output: (SubPlan 3), t1.v, t1.id
|
Output: (SubPlan expr_3), t1.v, t1.id
|
||||||
SubPlan 3
|
SubPlan expr_3
|
||||||
-> Bitmap Heap Scan on pg_temp.gstest5 t2
|
-> Bitmap Heap Scan on pg_temp.gstest5 t2
|
||||||
Output: t1.v
|
Output: t1.v
|
||||||
Recheck Cond: (t2.id = t1.id)
|
Recheck Cond: (t2.id = t1.id)
|
||||||
|
@@ -1609,13 +1609,13 @@ from tenk1 t, generate_series(1, 1000);
|
|||||||
---------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------
|
||||||
Unique
|
Unique
|
||||||
-> Sort
|
-> Sort
|
||||||
Sort Key: t.unique1, ((SubPlan 1))
|
Sort Key: t.unique1, ((SubPlan expr_1))
|
||||||
-> Gather
|
-> Gather
|
||||||
Workers Planned: 2
|
Workers Planned: 2
|
||||||
-> Nested Loop
|
-> Nested Loop
|
||||||
-> Parallel Index Only Scan using tenk1_unique1 on tenk1 t
|
-> Parallel Index Only Scan using tenk1_unique1 on tenk1 t
|
||||||
-> Function Scan on generate_series
|
-> Function Scan on generate_series
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Index Only Scan using tenk1_unique1 on tenk1
|
-> Index Only Scan using tenk1_unique1 on tenk1
|
||||||
Index Cond: (unique1 = t.unique1)
|
Index Cond: (unique1 = t.unique1)
|
||||||
(11 rows)
|
(11 rows)
|
||||||
@@ -1628,13 +1628,13 @@ order by 1, 2;
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
Sort
|
Sort
|
||||||
Sort Key: t.unique1, ((SubPlan 1))
|
Sort Key: t.unique1, ((SubPlan expr_1))
|
||||||
-> Gather
|
-> Gather
|
||||||
Workers Planned: 2
|
Workers Planned: 2
|
||||||
-> Nested Loop
|
-> Nested Loop
|
||||||
-> Parallel Index Only Scan using tenk1_unique1 on tenk1 t
|
-> Parallel Index Only Scan using tenk1_unique1 on tenk1 t
|
||||||
-> Function Scan on generate_series
|
-> Function Scan on generate_series
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Index Only Scan using tenk1_unique1 on tenk1
|
-> Index Only Scan using tenk1_unique1 on tenk1
|
||||||
Index Cond: (unique1 = t.unique1)
|
Index Cond: (unique1 = t.unique1)
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
@@ -1758,9 +1758,9 @@ explain (verbose, costs off) select min(1-id) from matest0;
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Output: (InitPlan 1).col1
|
Output: (InitPlan minmax_1).col1
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
Output: ((1 - matest0.id))
|
Output: ((1 - matest0.id))
|
||||||
-> Result
|
-> Result
|
||||||
@@ -1948,7 +1948,7 @@ SELECT min(x) FROM
|
|||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Merge Append
|
-> Merge Append
|
||||||
Sort Key: a.unique1
|
Sort Key: a.unique1
|
||||||
@@ -1967,7 +1967,7 @@ SELECT min(y) FROM
|
|||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Merge Append
|
-> Merge Append
|
||||||
Sort Key: a.unique1
|
Sort Key: a.unique1
|
||||||
@@ -2008,7 +2008,7 @@ FROM generate_series(1, 3) g(i);
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
Function Scan on generate_series g
|
Function Scan on generate_series g
|
||||||
SubPlan 1
|
SubPlan array_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Merge Append
|
-> Merge Append
|
||||||
Sort Key: ((d.d + g.i))
|
Sort Key: ((d.d + g.i))
|
||||||
@@ -2048,19 +2048,19 @@ insert into inhpar select x, x::text from generate_series(1,5) x;
|
|||||||
insert into inhcld select x::text, x from generate_series(6,10) x;
|
insert into inhcld select x::text, x from generate_series(6,10) x;
|
||||||
explain (verbose, costs off)
|
explain (verbose, costs off)
|
||||||
update inhpar i set (f1, f2) = (select i.f1, i.f2 || '-' from int4_tbl limit 1);
|
update inhpar i set (f1, f2) = (select i.f1, i.f2 || '-' from int4_tbl limit 1);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------------------------------
|
||||||
Update on public.inhpar i
|
Update on public.inhpar i
|
||||||
Update on public.inhpar i_1
|
Update on public.inhpar i_1
|
||||||
Update on public.inhcld i_2
|
Update on public.inhcld i_2
|
||||||
-> Result
|
-> Result
|
||||||
Output: (SubPlan 1).col1, (SubPlan 1).col2, (rescan SubPlan 1), i.tableoid, i.ctid
|
Output: (SubPlan multiexpr_1).col1, (SubPlan multiexpr_1).col2, (rescan SubPlan multiexpr_1), i.tableoid, i.ctid
|
||||||
-> Append
|
-> Append
|
||||||
-> Seq Scan on public.inhpar i_1
|
-> Seq Scan on public.inhpar i_1
|
||||||
Output: i_1.f1, i_1.f2, i_1.tableoid, i_1.ctid
|
Output: i_1.f1, i_1.f2, i_1.tableoid, i_1.ctid
|
||||||
-> Seq Scan on public.inhcld i_2
|
-> Seq Scan on public.inhcld i_2
|
||||||
Output: i_2.f1, i_2.f2, i_2.tableoid, i_2.ctid
|
Output: i_2.f1, i_2.f2, i_2.tableoid, i_2.ctid
|
||||||
SubPlan 1
|
SubPlan multiexpr_1
|
||||||
-> Limit
|
-> Limit
|
||||||
Output: (i.f1), (((i.f2)::text || '-'::text))
|
Output: (i.f1), (((i.f2)::text || '-'::text))
|
||||||
-> Seq Scan on public.int4_tbl
|
-> Seq Scan on public.int4_tbl
|
||||||
@@ -2096,21 +2096,21 @@ alter table inhpar attach partition inhcld2 for values from (5) to (100);
|
|||||||
insert into inhpar select x, x::text from generate_series(1,10) x;
|
insert into inhpar select x, x::text from generate_series(1,10) x;
|
||||||
explain (verbose, costs off)
|
explain (verbose, costs off)
|
||||||
update inhpar i set (f1, f2) = (select i.f1, i.f2 || '-' from int4_tbl limit 1);
|
update inhpar i set (f1, f2) = (select i.f1, i.f2 || '-' from int4_tbl limit 1);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
Update on public.inhpar i
|
Update on public.inhpar i
|
||||||
Update on public.inhcld1 i_1
|
Update on public.inhcld1 i_1
|
||||||
Update on public.inhcld2 i_2
|
Update on public.inhcld2 i_2
|
||||||
-> Append
|
-> Append
|
||||||
-> Seq Scan on public.inhcld1 i_1
|
-> Seq Scan on public.inhcld1 i_1
|
||||||
Output: (SubPlan 1).col1, (SubPlan 1).col2, (rescan SubPlan 1), i_1.tableoid, i_1.ctid
|
Output: (SubPlan multiexpr_1).col1, (SubPlan multiexpr_1).col2, (rescan SubPlan multiexpr_1), i_1.tableoid, i_1.ctid
|
||||||
SubPlan 1
|
SubPlan multiexpr_1
|
||||||
-> Limit
|
-> Limit
|
||||||
Output: (i_1.f1), (((i_1.f2)::text || '-'::text))
|
Output: (i_1.f1), (((i_1.f2)::text || '-'::text))
|
||||||
-> Seq Scan on public.int4_tbl
|
-> Seq Scan on public.int4_tbl
|
||||||
Output: i_1.f1, ((i_1.f2)::text || '-'::text)
|
Output: i_1.f1, ((i_1.f2)::text || '-'::text)
|
||||||
-> Seq Scan on public.inhcld2 i_2
|
-> Seq Scan on public.inhcld2 i_2
|
||||||
Output: (SubPlan 1).col1, (SubPlan 1).col2, (rescan SubPlan 1), i_2.tableoid, i_2.ctid
|
Output: (SubPlan multiexpr_1).col1, (SubPlan multiexpr_1).col2, (rescan SubPlan multiexpr_1), i_2.tableoid, i_2.ctid
|
||||||
(13 rows)
|
(13 rows)
|
||||||
|
|
||||||
update inhpar i set (f1, f2) = (select i.f1, i.f2 || '-' from int4_tbl limit 1);
|
update inhpar i set (f1, f2) = (select i.f1, i.f2 || '-' from int4_tbl limit 1);
|
||||||
@@ -3260,11 +3260,11 @@ explain (costs off) select min(a), max(a) from parted_minmax where b = '12345';
|
|||||||
------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan using parted_minmax1i on parted_minmax1 parted_minmax
|
-> Index Only Scan using parted_minmax1i on parted_minmax1 parted_minmax
|
||||||
Index Cond: ((a IS NOT NULL) AND (b = '12345'::text))
|
Index Cond: ((a IS NOT NULL) AND (b = '12345'::text))
|
||||||
InitPlan 2
|
InitPlan minmax_2
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan Backward using parted_minmax1i on parted_minmax1 parted_minmax_1
|
-> Index Only Scan Backward using parted_minmax1i on parted_minmax1 parted_minmax_1
|
||||||
Index Cond: ((a IS NOT NULL) AND (b = '12345'::text))
|
Index Cond: ((a IS NOT NULL) AND (b = '12345'::text))
|
||||||
|
@@ -61,9 +61,9 @@ explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on con
|
|||||||
Insert on insertconflicttest
|
Insert on insertconflicttest
|
||||||
Conflict Resolution: UPDATE
|
Conflict Resolution: UPDATE
|
||||||
Conflict Arbiter Indexes: op_index_key, collation_index_key, both_index_key
|
Conflict Arbiter Indexes: op_index_key, collation_index_key, both_index_key
|
||||||
Conflict Filter: EXISTS(SubPlan 1)
|
Conflict Filter: EXISTS(SubPlan exists_1)
|
||||||
-> Result
|
-> Result
|
||||||
SubPlan 1
|
SubPlan exists_1
|
||||||
-> Index Only Scan using both_index_expr_key on insertconflicttest ii
|
-> Index Only Scan using both_index_expr_key on insertconflicttest ii
|
||||||
Index Cond: (key = excluded.key)
|
Index Cond: (key = excluded.key)
|
||||||
(8 rows)
|
(8 rows)
|
||||||
|
@@ -2375,7 +2375,7 @@ order by t1.unique1;
|
|||||||
Sort
|
Sort
|
||||||
Sort Key: t1.unique1
|
Sort Key: t1.unique1
|
||||||
-> Hash Join
|
-> Hash Join
|
||||||
Hash Cond: ((t1.two = t2.two) AND (t1.unique1 = (SubPlan 2)))
|
Hash Cond: ((t1.two = t2.two) AND (t1.unique1 = (SubPlan expr_1)))
|
||||||
-> Bitmap Heap Scan on tenk1 t1
|
-> Bitmap Heap Scan on tenk1 t1
|
||||||
Recheck Cond: (unique1 < 10)
|
Recheck Cond: (unique1 < 10)
|
||||||
-> Bitmap Index Scan on tenk1_unique1
|
-> Bitmap Index Scan on tenk1_unique1
|
||||||
@@ -2385,10 +2385,10 @@ order by t1.unique1;
|
|||||||
Recheck Cond: (unique1 < 10)
|
Recheck Cond: (unique1 < 10)
|
||||||
-> Bitmap Index Scan on tenk1_unique1
|
-> Bitmap Index Scan on tenk1_unique1
|
||||||
Index Cond: (unique1 < 10)
|
Index Cond: (unique1 < 10)
|
||||||
SubPlan 2
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Only Scan using tenk1_unique1 on tenk1
|
-> Index Only Scan using tenk1_unique1 on tenk1
|
||||||
Index Cond: ((unique1 IS NOT NULL) AND (unique1 = t2.unique1))
|
Index Cond: ((unique1 IS NOT NULL) AND (unique1 = t2.unique1))
|
||||||
@@ -3181,11 +3181,11 @@ where unique1 in (select unique2 from tenk1 b);
|
|||||||
explain (costs off)
|
explain (costs off)
|
||||||
select a.* from tenk1 a
|
select a.* from tenk1 a
|
||||||
where unique1 not in (select unique2 from tenk1 b);
|
where unique1 not in (select unique2 from tenk1 b);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
Seq Scan on tenk1 a
|
Seq Scan on tenk1 a
|
||||||
Filter: (NOT (ANY (unique1 = (hashed SubPlan 1).col1)))
|
Filter: (NOT (ANY (unique1 = (hashed SubPlan any_1).col1)))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Index Only Scan using tenk1_unique2 on tenk1 b
|
-> Index Only Scan using tenk1_unique2 on tenk1 b
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
@@ -3706,11 +3706,11 @@ order by 1,2;
|
|||||||
Sort Key: t1.q1, t1.q2
|
Sort Key: t1.q1, t1.q2
|
||||||
-> Hash Left Join
|
-> Hash Left Join
|
||||||
Hash Cond: (t1.q2 = t2.q1)
|
Hash Cond: (t1.q2 = t2.q1)
|
||||||
Filter: (1 = (SubPlan 1))
|
Filter: (1 = (SubPlan expr_1))
|
||||||
-> Seq Scan on int8_tbl t1
|
-> Seq Scan on int8_tbl t1
|
||||||
-> Hash
|
-> Hash
|
||||||
-> Seq Scan on int8_tbl t2
|
-> Seq Scan on int8_tbl t2
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Result
|
-> Result
|
||||||
One-Time Filter: ((42) IS NOT NULL)
|
One-Time Filter: ((42) IS NOT NULL)
|
||||||
@@ -4225,14 +4225,14 @@ from int8_tbl i8
|
|||||||
right join (select false as z) ss3 on true,
|
right join (select false as z) ss3 on true,
|
||||||
lateral (select i8.q2 as q2l where x limit 1) ss4
|
lateral (select i8.q2 as q2l where x limit 1) ss4
|
||||||
where i8.q2 = 123;
|
where i8.q2 = 123;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Nested Loop
|
Nested Loop
|
||||||
Output: i8.q1, i8.q2, (InitPlan 1).col1, false, (i8.q2)
|
Output: i8.q1, i8.q2, (InitPlan expr_1).col1, false, (i8.q2)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: true
|
Output: true
|
||||||
InitPlan 2
|
InitPlan expr_2
|
||||||
-> Result
|
-> Result
|
||||||
Output: true
|
Output: true
|
||||||
-> Seq Scan on public.int4_tbl i4
|
-> Seq Scan on public.int4_tbl i4
|
||||||
@@ -4241,7 +4241,7 @@ where i8.q2 = 123;
|
|||||||
-> Nested Loop
|
-> Nested Loop
|
||||||
Output: i8.q1, i8.q2, (i8.q2)
|
Output: i8.q1, i8.q2, (i8.q2)
|
||||||
-> Subquery Scan on ss1
|
-> Subquery Scan on ss1
|
||||||
Output: ss1.y, (InitPlan 1).col1
|
Output: ss1.y, (InitPlan expr_1).col1
|
||||||
-> Limit
|
-> Limit
|
||||||
Output: NULL::integer
|
Output: NULL::integer
|
||||||
-> Result
|
-> Result
|
||||||
@@ -4255,7 +4255,7 @@ where i8.q2 = 123;
|
|||||||
Output: (i8.q2)
|
Output: (i8.q2)
|
||||||
-> Result
|
-> Result
|
||||||
Output: i8.q2
|
Output: i8.q2
|
||||||
One-Time Filter: ((InitPlan 1).col1)
|
One-Time Filter: ((InitPlan expr_1).col1)
|
||||||
(29 rows)
|
(29 rows)
|
||||||
|
|
||||||
explain (verbose, costs off)
|
explain (verbose, costs off)
|
||||||
@@ -4268,14 +4268,14 @@ from int8_tbl i8
|
|||||||
right join (select false as z) ss3 on true,
|
right join (select false as z) ss3 on true,
|
||||||
lateral (select i8.q2 as q2l where x limit 1) ss4
|
lateral (select i8.q2 as q2l where x limit 1) ss4
|
||||||
where i8.q2 = 123;
|
where i8.q2 = 123;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Nested Loop
|
Nested Loop
|
||||||
Output: i8.q1, i8.q2, (InitPlan 1).col1, false, (i8.q2)
|
Output: i8.q1, i8.q2, (InitPlan expr_1).col1, false, (i8.q2)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: true
|
Output: true
|
||||||
InitPlan 2
|
InitPlan expr_2
|
||||||
-> Result
|
-> Result
|
||||||
Output: true
|
Output: true
|
||||||
-> Limit
|
-> Limit
|
||||||
@@ -4285,7 +4285,7 @@ where i8.q2 = 123;
|
|||||||
-> Nested Loop
|
-> Nested Loop
|
||||||
Output: i8.q1, i8.q2, (i8.q2)
|
Output: i8.q1, i8.q2, (i8.q2)
|
||||||
-> Seq Scan on public.int4_tbl i4
|
-> Seq Scan on public.int4_tbl i4
|
||||||
Output: i4.f1, (InitPlan 1).col1
|
Output: i4.f1, (InitPlan expr_1).col1
|
||||||
Filter: (i4.f1 = 0)
|
Filter: (i4.f1 = 0)
|
||||||
-> Nested Loop
|
-> Nested Loop
|
||||||
Output: i8.q1, i8.q2, (i8.q2)
|
Output: i8.q1, i8.q2, (i8.q2)
|
||||||
@@ -4296,7 +4296,7 @@ where i8.q2 = 123;
|
|||||||
Output: (i8.q2)
|
Output: (i8.q2)
|
||||||
-> Result
|
-> Result
|
||||||
Output: i8.q2
|
Output: i8.q2
|
||||||
One-Time Filter: ((InitPlan 1).col1)
|
One-Time Filter: ((InitPlan expr_1).col1)
|
||||||
(27 rows)
|
(27 rows)
|
||||||
|
|
||||||
-- Test proper handling of appendrel PHVs during useless-RTE removal
|
-- Test proper handling of appendrel PHVs during useless-RTE removal
|
||||||
@@ -5757,13 +5757,13 @@ explain (costs off)
|
|||||||
select a.unique1, b.unique2
|
select a.unique1, b.unique2
|
||||||
from onek a left join onek b on a.unique1 = b.unique2
|
from onek a left join onek b on a.unique1 = b.unique2
|
||||||
where (b.unique2, random() > 0) = any (select q1, random() > 0 from int8_tbl c where c.q1 < b.unique1);
|
where (b.unique2, random() > 0) = any (select q1, random() > 0 from int8_tbl c where c.q1 < b.unique1);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
------------------------------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------------------------------
|
||||||
Hash Join
|
Hash Join
|
||||||
Hash Cond: (b.unique2 = a.unique1)
|
Hash Cond: (b.unique2 = a.unique1)
|
||||||
-> Seq Scan on onek b
|
-> Seq Scan on onek b
|
||||||
Filter: (ANY ((unique2 = (SubPlan 1).col1) AND ((random() > '0'::double precision) = (SubPlan 1).col2)))
|
Filter: (ANY ((unique2 = (SubPlan any_1).col1) AND ((random() > '0'::double precision) = (SubPlan any_1).col2)))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on int8_tbl c
|
-> Seq Scan on int8_tbl c
|
||||||
Filter: (q1 < b.unique1)
|
Filter: (q1 < b.unique1)
|
||||||
-> Hash
|
-> Hash
|
||||||
@@ -6105,7 +6105,7 @@ select exists(
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Seq Scan on int4_tbl x0
|
Seq Scan on int4_tbl x0
|
||||||
SubPlan 1
|
SubPlan exists_1
|
||||||
-> Nested Loop Left Join
|
-> Nested Loop Left Join
|
||||||
Join Filter: (t2.q2 = t4.q2)
|
Join Filter: (t2.q2 = t4.q2)
|
||||||
-> Nested Loop Left Join
|
-> Nested Loop Left Join
|
||||||
@@ -6956,7 +6956,7 @@ where t1.a = t2.a;
|
|||||||
------------------------------------------
|
------------------------------------------
|
||||||
Seq Scan on sj t2
|
Seq Scan on sj t2
|
||||||
Filter: (a IS NOT NULL)
|
Filter: (a IS NOT NULL)
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
One-Time Filter: (t2.a = t2.a)
|
One-Time Filter: (t2.a = t2.a)
|
||||||
-> Seq Scan on sj
|
-> Seq Scan on sj
|
||||||
@@ -8983,8 +8983,8 @@ lateral (select * from int8_tbl t1,
|
|||||||
where q2 = (select greatest(t1.q1,t2.q2))
|
where q2 = (select greatest(t1.q1,t2.q2))
|
||||||
and (select v.id=0)) offset 0) ss2) ss
|
and (select v.id=0)) offset 0) ss2) ss
|
||||||
where t1.q1 = ss.q2) ss0;
|
where t1.q1 = ss.q2) ss0;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
Nested Loop
|
Nested Loop
|
||||||
Output: "*VALUES*".column1, t1.q1, t1.q2, ss2.q1, ss2.q2
|
Output: "*VALUES*".column1, t1.q1, t1.q2, ss2.q1, ss2.q2
|
||||||
-> Seq Scan on public.int8_tbl t1
|
-> Seq Scan on public.int8_tbl t1
|
||||||
@@ -8998,20 +8998,20 @@ lateral (select * from int8_tbl t1,
|
|||||||
Filter: (t1.q1 = ss2.q2)
|
Filter: (t1.q1 = ss2.q2)
|
||||||
-> Seq Scan on public.int8_tbl t2
|
-> Seq Scan on public.int8_tbl t2
|
||||||
Output: t2.q1, t2.q2
|
Output: t2.q1, t2.q2
|
||||||
Filter: (ANY ((t2.q1 = (SubPlan 3).col1) AND ((random() > '0'::double precision) = (SubPlan 3).col2)))
|
Filter: (ANY ((t2.q1 = (SubPlan any_1).col1) AND ((random() > '0'::double precision) = (SubPlan any_1).col2)))
|
||||||
SubPlan 3
|
SubPlan any_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: t3.q2, (random() > '0'::double precision)
|
Output: t3.q2, (random() > '0'::double precision)
|
||||||
One-Time Filter: (InitPlan 2).col1
|
One-Time Filter: (InitPlan expr_2).col1
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: GREATEST(t1.q1, t2.q2)
|
Output: GREATEST(t1.q1, t2.q2)
|
||||||
InitPlan 2
|
InitPlan expr_2
|
||||||
-> Result
|
-> Result
|
||||||
Output: ("*VALUES*".column1 = 0)
|
Output: ("*VALUES*".column1 = 0)
|
||||||
-> Seq Scan on public.int8_tbl t3
|
-> Seq Scan on public.int8_tbl t3
|
||||||
Output: t3.q1, t3.q2
|
Output: t3.q1, t3.q2
|
||||||
Filter: (t3.q2 = (InitPlan 1).col1)
|
Filter: (t3.q2 = (InitPlan expr_1).col1)
|
||||||
(27 rows)
|
(27 rows)
|
||||||
|
|
||||||
select * from (values (0), (1)) v(id),
|
select * from (values (0), (1)) v(id),
|
||||||
@@ -9723,13 +9723,13 @@ SELECT * FROM rescan_bhs t1 LEFT JOIN rescan_bhs t2 ON t1.a IN
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
Nested Loop Left Join
|
Nested Loop Left Join
|
||||||
Join Filter: (ANY (t1.a = (SubPlan 1).col1))
|
Join Filter: (ANY (t1.a = (SubPlan any_1).col1))
|
||||||
-> Bitmap Heap Scan on rescan_bhs t1
|
-> Bitmap Heap Scan on rescan_bhs t1
|
||||||
-> Bitmap Index Scan on rescan_bhs_a_idx
|
-> Bitmap Index Scan on rescan_bhs_a_idx
|
||||||
-> Materialize
|
-> Materialize
|
||||||
-> Bitmap Heap Scan on rescan_bhs t2
|
-> Bitmap Heap Scan on rescan_bhs t2
|
||||||
-> Bitmap Index Scan on rescan_bhs_a_idx
|
-> Bitmap Index Scan on rescan_bhs_a_idx
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Result
|
-> Result
|
||||||
One-Time Filter: (t2.a > 1)
|
One-Time Filter: (t2.a > 1)
|
||||||
-> Bitmap Heap Scan on rescan_bhs t3
|
-> Bitmap Heap Scan on rescan_bhs t3
|
||||||
|
@@ -1031,30 +1031,30 @@ WHERE
|
|||||||
------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------
|
||||||
Hash Join
|
Hash Join
|
||||||
Output: hjtest_1.a, hjtest_2.a, (hjtest_1.tableoid)::regclass, (hjtest_2.tableoid)::regclass
|
Output: hjtest_1.a, hjtest_2.a, (hjtest_1.tableoid)::regclass, (hjtest_2.tableoid)::regclass
|
||||||
Hash Cond: ((hjtest_1.id = (SubPlan 1)) AND ((SubPlan 2) = (SubPlan 3)))
|
Hash Cond: ((hjtest_1.id = (SubPlan expr_1)) AND ((SubPlan expr_2) = (SubPlan expr_3)))
|
||||||
Join Filter: (hjtest_1.a <> hjtest_2.b)
|
Join Filter: (hjtest_1.a <> hjtest_2.b)
|
||||||
-> Seq Scan on public.hjtest_1
|
-> Seq Scan on public.hjtest_1
|
||||||
Output: hjtest_1.a, hjtest_1.tableoid, hjtest_1.id, hjtest_1.b
|
Output: hjtest_1.a, hjtest_1.tableoid, hjtest_1.id, hjtest_1.b
|
||||||
Filter: ((SubPlan 4) < 50)
|
Filter: ((SubPlan expr_4) < 50)
|
||||||
SubPlan 4
|
SubPlan expr_4
|
||||||
-> Result
|
-> Result
|
||||||
Output: (hjtest_1.b * 5)
|
Output: (hjtest_1.b * 5)
|
||||||
-> Hash
|
-> Hash
|
||||||
Output: hjtest_2.a, hjtest_2.tableoid, hjtest_2.id, hjtest_2.c, hjtest_2.b
|
Output: hjtest_2.a, hjtest_2.tableoid, hjtest_2.id, hjtest_2.c, hjtest_2.b
|
||||||
-> Seq Scan on public.hjtest_2
|
-> Seq Scan on public.hjtest_2
|
||||||
Output: hjtest_2.a, hjtest_2.tableoid, hjtest_2.id, hjtest_2.c, hjtest_2.b
|
Output: hjtest_2.a, hjtest_2.tableoid, hjtest_2.id, hjtest_2.c, hjtest_2.b
|
||||||
Filter: ((SubPlan 5) < 55)
|
Filter: ((SubPlan expr_5) < 55)
|
||||||
SubPlan 5
|
SubPlan expr_5
|
||||||
-> Result
|
-> Result
|
||||||
Output: (hjtest_2.c * 5)
|
Output: (hjtest_2.c * 5)
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: 1
|
Output: 1
|
||||||
One-Time Filter: (hjtest_2.id = 1)
|
One-Time Filter: (hjtest_2.id = 1)
|
||||||
SubPlan 3
|
SubPlan expr_3
|
||||||
-> Result
|
-> Result
|
||||||
Output: (hjtest_2.c * 5)
|
Output: (hjtest_2.c * 5)
|
||||||
SubPlan 2
|
SubPlan expr_2
|
||||||
-> Result
|
-> Result
|
||||||
Output: (hjtest_1.b * 5)
|
Output: (hjtest_1.b * 5)
|
||||||
(28 rows)
|
(28 rows)
|
||||||
@@ -1085,30 +1085,30 @@ WHERE
|
|||||||
------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------
|
||||||
Hash Join
|
Hash Join
|
||||||
Output: hjtest_1.a, hjtest_2.a, (hjtest_1.tableoid)::regclass, (hjtest_2.tableoid)::regclass
|
Output: hjtest_1.a, hjtest_2.a, (hjtest_1.tableoid)::regclass, (hjtest_2.tableoid)::regclass
|
||||||
Hash Cond: (((SubPlan 1) = hjtest_1.id) AND ((SubPlan 3) = (SubPlan 2)))
|
Hash Cond: (((SubPlan expr_1) = hjtest_1.id) AND ((SubPlan expr_3) = (SubPlan expr_2)))
|
||||||
Join Filter: (hjtest_1.a <> hjtest_2.b)
|
Join Filter: (hjtest_1.a <> hjtest_2.b)
|
||||||
-> Seq Scan on public.hjtest_2
|
-> Seq Scan on public.hjtest_2
|
||||||
Output: hjtest_2.a, hjtest_2.tableoid, hjtest_2.id, hjtest_2.c, hjtest_2.b
|
Output: hjtest_2.a, hjtest_2.tableoid, hjtest_2.id, hjtest_2.c, hjtest_2.b
|
||||||
Filter: ((SubPlan 5) < 55)
|
Filter: ((SubPlan expr_5) < 55)
|
||||||
SubPlan 5
|
SubPlan expr_5
|
||||||
-> Result
|
-> Result
|
||||||
Output: (hjtest_2.c * 5)
|
Output: (hjtest_2.c * 5)
|
||||||
-> Hash
|
-> Hash
|
||||||
Output: hjtest_1.a, hjtest_1.tableoid, hjtest_1.id, hjtest_1.b
|
Output: hjtest_1.a, hjtest_1.tableoid, hjtest_1.id, hjtest_1.b
|
||||||
-> Seq Scan on public.hjtest_1
|
-> Seq Scan on public.hjtest_1
|
||||||
Output: hjtest_1.a, hjtest_1.tableoid, hjtest_1.id, hjtest_1.b
|
Output: hjtest_1.a, hjtest_1.tableoid, hjtest_1.id, hjtest_1.b
|
||||||
Filter: ((SubPlan 4) < 50)
|
Filter: ((SubPlan expr_4) < 50)
|
||||||
SubPlan 4
|
SubPlan expr_4
|
||||||
-> Result
|
-> Result
|
||||||
Output: (hjtest_1.b * 5)
|
Output: (hjtest_1.b * 5)
|
||||||
SubPlan 2
|
SubPlan expr_2
|
||||||
-> Result
|
-> Result
|
||||||
Output: (hjtest_1.b * 5)
|
Output: (hjtest_1.b * 5)
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: 1
|
Output: 1
|
||||||
One-Time Filter: (hjtest_2.id = 1)
|
One-Time Filter: (hjtest_2.id = 1)
|
||||||
SubPlan 3
|
SubPlan expr_3
|
||||||
-> Result
|
-> Result
|
||||||
Output: (hjtest_2.c * 5)
|
Output: (hjtest_2.c * 5)
|
||||||
(28 rows)
|
(28 rows)
|
||||||
|
@@ -429,8 +429,8 @@ WHERE unique1 < 3
|
|||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
Index Scan using tenk1_unique1 on tenk1 t0
|
Index Scan using tenk1_unique1 on tenk1 t0
|
||||||
Index Cond: (unique1 < 3)
|
Index Cond: (unique1 < 3)
|
||||||
Filter: EXISTS(SubPlan 1)
|
Filter: EXISTS(SubPlan exists_1)
|
||||||
SubPlan 1
|
SubPlan exists_1
|
||||||
-> Nested Loop
|
-> Nested Loop
|
||||||
-> Index Scan using tenk1_hundred on tenk1 t2
|
-> Index Scan using tenk1_hundred on tenk1 t2
|
||||||
Filter: (t0.two <> four)
|
Filter: (t0.two <> four)
|
||||||
|
@@ -1828,29 +1828,29 @@ WHEN MATCHED AND t.c > s.cnt THEN
|
|||||||
-> Hash Join
|
-> Hash Join
|
||||||
Output: t.ctid, s.a, s.b, s.c, s.d, s.ctid
|
Output: t.ctid, s.a, s.b, s.c, s.d, s.ctid
|
||||||
Hash Cond: (t.a = s.a)
|
Hash Cond: (t.a = s.a)
|
||||||
Join Filter: (t.b < (SubPlan 1))
|
Join Filter: (t.b < (SubPlan expr_1))
|
||||||
-> Seq Scan on public.tgt t
|
-> Seq Scan on public.tgt t
|
||||||
Output: t.ctid, t.a, t.b
|
Output: t.ctid, t.a, t.b
|
||||||
-> Hash
|
-> Hash
|
||||||
Output: s.a, s.b, s.c, s.d, s.ctid
|
Output: s.a, s.b, s.c, s.d, s.ctid
|
||||||
-> Seq Scan on public.src s
|
-> Seq Scan on public.src s
|
||||||
Output: s.a, s.b, s.c, s.d, s.ctid
|
Output: s.a, s.b, s.c, s.d, s.ctid
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Output: count(*)
|
Output: count(*)
|
||||||
-> Seq Scan on public.ref r
|
-> Seq Scan on public.ref r
|
||||||
Output: r.ab, r.cd
|
Output: r.ab, r.cd
|
||||||
Filter: ((r.ab = (s.a + s.b)) AND (r.cd = (s.c - s.d)))
|
Filter: ((r.ab = (s.a + s.b)) AND (r.cd = (s.c - s.d)))
|
||||||
SubPlan 4
|
SubPlan expr_3
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Output: count(*)
|
Output: count(*)
|
||||||
-> Seq Scan on public.ref r_2
|
-> Seq Scan on public.ref r_2
|
||||||
Output: r_2.ab, r_2.cd
|
Output: r_2.ab, r_2.cd
|
||||||
Filter: ((r_2.ab = (s.a + s.b)) AND (r_2.cd = (s.c - s.d)))
|
Filter: ((r_2.ab = (s.a + s.b)) AND (r_2.cd = (s.c - s.d)))
|
||||||
SubPlan 3
|
SubPlan multiexpr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: s.b, (InitPlan 2).col1
|
Output: s.b, (InitPlan expr_2).col1
|
||||||
InitPlan 2
|
InitPlan expr_2
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Output: count(*)
|
Output: count(*)
|
||||||
-> Seq Scan on public.ref r_1
|
-> Seq Scan on public.ref r_1
|
||||||
|
@@ -1915,21 +1915,21 @@ select * from
|
|||||||
from int4_tbl touter) ss,
|
from int4_tbl touter) ss,
|
||||||
asptab
|
asptab
|
||||||
where asptab.id > ss.b::int;
|
where asptab.id > ss.b::int;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
Nested Loop
|
Nested Loop
|
||||||
-> Seq Scan on int4_tbl touter
|
-> Seq Scan on int4_tbl touter
|
||||||
-> Append
|
-> Append
|
||||||
-> Index Only Scan using asptab0_pkey on asptab0 asptab_1
|
-> Index Only Scan using asptab0_pkey on asptab0 asptab_1
|
||||||
Index Cond: (id > (EXISTS(SubPlan 3))::integer)
|
Index Cond: (id > (EXISTS(SubPlan exists_3))::integer)
|
||||||
SubPlan 4
|
SubPlan exists_4
|
||||||
-> Seq Scan on int4_tbl tinner_2
|
-> Seq Scan on int4_tbl tinner_2
|
||||||
-> Index Only Scan using asptab1_pkey on asptab1 asptab_2
|
-> Index Only Scan using asptab1_pkey on asptab1 asptab_2
|
||||||
Index Cond: (id > (EXISTS(SubPlan 3))::integer)
|
Index Cond: (id > (EXISTS(SubPlan exists_3))::integer)
|
||||||
SubPlan 3
|
SubPlan exists_3
|
||||||
-> Seq Scan on int4_tbl tinner_1
|
-> Seq Scan on int4_tbl tinner_1
|
||||||
Filter: (f1 = touter.f1)
|
Filter: (f1 = touter.f1)
|
||||||
SubPlan 2
|
SubPlan exists_2
|
||||||
-> Seq Scan on int4_tbl tinner
|
-> Seq Scan on int4_tbl tinner
|
||||||
(14 rows)
|
(14 rows)
|
||||||
|
|
||||||
@@ -2236,36 +2236,36 @@ explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q1
|
|||||||
prepare ab_q2 (int, int) as
|
prepare ab_q2 (int, int) as
|
||||||
select a from ab where a between $1 and $2 and b < (select 3);
|
select a from ab where a between $1 and $2 and b < (select 3);
|
||||||
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q2 (2, 2);
|
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q2 (2, 2);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
Append (actual rows=0.00 loops=1)
|
Append (actual rows=0.00 loops=1)
|
||||||
Subplans Removed: 6
|
Subplans Removed: 6
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=1.00 loops=1)
|
-> Result (actual rows=1.00 loops=1)
|
||||||
-> Seq Scan on ab_a2_b1 ab_1 (actual rows=0.00 loops=1)
|
-> Seq Scan on ab_a2_b1 ab_1 (actual rows=0.00 loops=1)
|
||||||
Filter: ((a >= $1) AND (a <= $2) AND (b < (InitPlan 1).col1))
|
Filter: ((a >= $1) AND (a <= $2) AND (b < (InitPlan expr_1).col1))
|
||||||
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0.00 loops=1)
|
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0.00 loops=1)
|
||||||
Filter: ((a >= $1) AND (a <= $2) AND (b < (InitPlan 1).col1))
|
Filter: ((a >= $1) AND (a <= $2) AND (b < (InitPlan expr_1).col1))
|
||||||
-> Seq Scan on ab_a2_b3 ab_3 (never executed)
|
-> Seq Scan on ab_a2_b3 ab_3 (never executed)
|
||||||
Filter: ((a >= $1) AND (a <= $2) AND (b < (InitPlan 1).col1))
|
Filter: ((a >= $1) AND (a <= $2) AND (b < (InitPlan expr_1).col1))
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
-- As above, but swap the PARAM_EXEC Param to the first partition level
|
-- As above, but swap the PARAM_EXEC Param to the first partition level
|
||||||
prepare ab_q3 (int, int) as
|
prepare ab_q3 (int, int) as
|
||||||
select a from ab where b between $1 and $2 and a < (select 3);
|
select a from ab where b between $1 and $2 and a < (select 3);
|
||||||
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q3 (2, 2);
|
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q3 (2, 2);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
Append (actual rows=0.00 loops=1)
|
Append (actual rows=0.00 loops=1)
|
||||||
Subplans Removed: 6
|
Subplans Removed: 6
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=1.00 loops=1)
|
-> Result (actual rows=1.00 loops=1)
|
||||||
-> Seq Scan on ab_a1_b2 ab_1 (actual rows=0.00 loops=1)
|
-> Seq Scan on ab_a1_b2 ab_1 (actual rows=0.00 loops=1)
|
||||||
Filter: ((b >= $1) AND (b <= $2) AND (a < (InitPlan 1).col1))
|
Filter: ((b >= $1) AND (b <= $2) AND (a < (InitPlan expr_1).col1))
|
||||||
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0.00 loops=1)
|
-> Seq Scan on ab_a2_b2 ab_2 (actual rows=0.00 loops=1)
|
||||||
Filter: ((b >= $1) AND (b <= $2) AND (a < (InitPlan 1).col1))
|
Filter: ((b >= $1) AND (b <= $2) AND (a < (InitPlan expr_1).col1))
|
||||||
-> Seq Scan on ab_a3_b2 ab_3 (never executed)
|
-> Seq Scan on ab_a3_b2 ab_3 (never executed)
|
||||||
Filter: ((b >= $1) AND (b <= $2) AND (a < (InitPlan 1).col1))
|
Filter: ((b >= $1) AND (b <= $2) AND (a < (InitPlan expr_1).col1))
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -2475,23 +2475,23 @@ select explain_parallel_append('execute ab_q5 (33, 44, 55)');
|
|||||||
|
|
||||||
-- Test Parallel Append with PARAM_EXEC Params
|
-- Test Parallel Append with PARAM_EXEC Params
|
||||||
select explain_parallel_append('select count(*) from ab where (a = (select 1) or a = (select 3)) and b = 2');
|
select explain_parallel_append('select count(*) from ab where (a = (select 1) or a = (select 3)) and b = 2');
|
||||||
explain_parallel_append
|
explain_parallel_append
|
||||||
------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------
|
||||||
Aggregate (actual rows=N loops=N)
|
Aggregate (actual rows=N loops=N)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=N loops=N)
|
-> Result (actual rows=N loops=N)
|
||||||
InitPlan 2
|
InitPlan expr_2
|
||||||
-> Result (actual rows=N loops=N)
|
-> Result (actual rows=N loops=N)
|
||||||
-> Gather (actual rows=N loops=N)
|
-> Gather (actual rows=N loops=N)
|
||||||
Workers Planned: 2
|
Workers Planned: 2
|
||||||
Workers Launched: N
|
Workers Launched: N
|
||||||
-> Parallel Append (actual rows=N loops=N)
|
-> Parallel Append (actual rows=N loops=N)
|
||||||
-> Parallel Seq Scan on ab_a1_b2 ab_1 (actual rows=N loops=N)
|
-> Parallel Seq Scan on ab_a1_b2 ab_1 (actual rows=N loops=N)
|
||||||
Filter: ((b = 2) AND ((a = (InitPlan 1).col1) OR (a = (InitPlan 2).col1)))
|
Filter: ((b = 2) AND ((a = (InitPlan expr_1).col1) OR (a = (InitPlan expr_2).col1)))
|
||||||
-> Parallel Seq Scan on ab_a2_b2 ab_2 (never executed)
|
-> Parallel Seq Scan on ab_a2_b2 ab_2 (never executed)
|
||||||
Filter: ((b = 2) AND ((a = (InitPlan 1).col1) OR (a = (InitPlan 2).col1)))
|
Filter: ((b = 2) AND ((a = (InitPlan expr_1).col1) OR (a = (InitPlan expr_2).col1)))
|
||||||
-> Parallel Seq Scan on ab_a3_b2 ab_3 (actual rows=N loops=N)
|
-> Parallel Seq Scan on ab_a3_b2 ab_3 (actual rows=N loops=N)
|
||||||
Filter: ((b = 2) AND ((a = (InitPlan 1).col1) OR (a = (InitPlan 2).col1)))
|
Filter: ((b = 2) AND ((a = (InitPlan expr_1).col1) OR (a = (InitPlan expr_2).col1)))
|
||||||
(15 rows)
|
(15 rows)
|
||||||
|
|
||||||
-- Test pruning during parallel nested loop query
|
-- Test pruning during parallel nested loop query
|
||||||
@@ -2692,65 +2692,65 @@ select * from ab where a = (select max(a) from lprt_a) and b = (select max(a)-1
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
Append (actual rows=0.00 loops=1)
|
Append (actual rows=0.00 loops=1)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Aggregate (actual rows=1.00 loops=1)
|
-> Aggregate (actual rows=1.00 loops=1)
|
||||||
-> Seq Scan on lprt_a (actual rows=102.00 loops=1)
|
-> Seq Scan on lprt_a (actual rows=102.00 loops=1)
|
||||||
InitPlan 2
|
InitPlan expr_2
|
||||||
-> Aggregate (actual rows=1.00 loops=1)
|
-> Aggregate (actual rows=1.00 loops=1)
|
||||||
-> Seq Scan on lprt_a lprt_a_1 (actual rows=102.00 loops=1)
|
-> Seq Scan on lprt_a lprt_a_1 (actual rows=102.00 loops=1)
|
||||||
-> Bitmap Heap Scan on ab_a1_b1 ab_1 (never executed)
|
-> Bitmap Heap Scan on ab_a1_b1 ab_1 (never executed)
|
||||||
Recheck Cond: (a = (InitPlan 1).col1)
|
Recheck Cond: (a = (InitPlan expr_1).col1)
|
||||||
Filter: (b = (InitPlan 2).col1)
|
Filter: (b = (InitPlan expr_2).col1)
|
||||||
-> Bitmap Index Scan on ab_a1_b1_a_idx (never executed)
|
-> Bitmap Index Scan on ab_a1_b1_a_idx (never executed)
|
||||||
Index Cond: (a = (InitPlan 1).col1)
|
Index Cond: (a = (InitPlan expr_1).col1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Bitmap Heap Scan on ab_a1_b2 ab_2 (never executed)
|
-> Bitmap Heap Scan on ab_a1_b2 ab_2 (never executed)
|
||||||
Recheck Cond: (a = (InitPlan 1).col1)
|
Recheck Cond: (a = (InitPlan expr_1).col1)
|
||||||
Filter: (b = (InitPlan 2).col1)
|
Filter: (b = (InitPlan expr_2).col1)
|
||||||
-> Bitmap Index Scan on ab_a1_b2_a_idx (never executed)
|
-> Bitmap Index Scan on ab_a1_b2_a_idx (never executed)
|
||||||
Index Cond: (a = (InitPlan 1).col1)
|
Index Cond: (a = (InitPlan expr_1).col1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Bitmap Heap Scan on ab_a1_b3 ab_3 (never executed)
|
-> Bitmap Heap Scan on ab_a1_b3 ab_3 (never executed)
|
||||||
Recheck Cond: (a = (InitPlan 1).col1)
|
Recheck Cond: (a = (InitPlan expr_1).col1)
|
||||||
Filter: (b = (InitPlan 2).col1)
|
Filter: (b = (InitPlan expr_2).col1)
|
||||||
-> Bitmap Index Scan on ab_a1_b3_a_idx (never executed)
|
-> Bitmap Index Scan on ab_a1_b3_a_idx (never executed)
|
||||||
Index Cond: (a = (InitPlan 1).col1)
|
Index Cond: (a = (InitPlan expr_1).col1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Bitmap Heap Scan on ab_a2_b1 ab_4 (never executed)
|
-> Bitmap Heap Scan on ab_a2_b1 ab_4 (never executed)
|
||||||
Recheck Cond: (a = (InitPlan 1).col1)
|
Recheck Cond: (a = (InitPlan expr_1).col1)
|
||||||
Filter: (b = (InitPlan 2).col1)
|
Filter: (b = (InitPlan expr_2).col1)
|
||||||
-> Bitmap Index Scan on ab_a2_b1_a_idx (never executed)
|
-> Bitmap Index Scan on ab_a2_b1_a_idx (never executed)
|
||||||
Index Cond: (a = (InitPlan 1).col1)
|
Index Cond: (a = (InitPlan expr_1).col1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Bitmap Heap Scan on ab_a2_b2 ab_5 (never executed)
|
-> Bitmap Heap Scan on ab_a2_b2 ab_5 (never executed)
|
||||||
Recheck Cond: (a = (InitPlan 1).col1)
|
Recheck Cond: (a = (InitPlan expr_1).col1)
|
||||||
Filter: (b = (InitPlan 2).col1)
|
Filter: (b = (InitPlan expr_2).col1)
|
||||||
-> Bitmap Index Scan on ab_a2_b2_a_idx (never executed)
|
-> Bitmap Index Scan on ab_a2_b2_a_idx (never executed)
|
||||||
Index Cond: (a = (InitPlan 1).col1)
|
Index Cond: (a = (InitPlan expr_1).col1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Bitmap Heap Scan on ab_a2_b3 ab_6 (never executed)
|
-> Bitmap Heap Scan on ab_a2_b3 ab_6 (never executed)
|
||||||
Recheck Cond: (a = (InitPlan 1).col1)
|
Recheck Cond: (a = (InitPlan expr_1).col1)
|
||||||
Filter: (b = (InitPlan 2).col1)
|
Filter: (b = (InitPlan expr_2).col1)
|
||||||
-> Bitmap Index Scan on ab_a2_b3_a_idx (never executed)
|
-> Bitmap Index Scan on ab_a2_b3_a_idx (never executed)
|
||||||
Index Cond: (a = (InitPlan 1).col1)
|
Index Cond: (a = (InitPlan expr_1).col1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Bitmap Heap Scan on ab_a3_b1 ab_7 (never executed)
|
-> Bitmap Heap Scan on ab_a3_b1 ab_7 (never executed)
|
||||||
Recheck Cond: (a = (InitPlan 1).col1)
|
Recheck Cond: (a = (InitPlan expr_1).col1)
|
||||||
Filter: (b = (InitPlan 2).col1)
|
Filter: (b = (InitPlan expr_2).col1)
|
||||||
-> Bitmap Index Scan on ab_a3_b1_a_idx (never executed)
|
-> Bitmap Index Scan on ab_a3_b1_a_idx (never executed)
|
||||||
Index Cond: (a = (InitPlan 1).col1)
|
Index Cond: (a = (InitPlan expr_1).col1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Bitmap Heap Scan on ab_a3_b2 ab_8 (actual rows=0.00 loops=1)
|
-> Bitmap Heap Scan on ab_a3_b2 ab_8 (actual rows=0.00 loops=1)
|
||||||
Recheck Cond: (a = (InitPlan 1).col1)
|
Recheck Cond: (a = (InitPlan expr_1).col1)
|
||||||
Filter: (b = (InitPlan 2).col1)
|
Filter: (b = (InitPlan expr_2).col1)
|
||||||
-> Bitmap Index Scan on ab_a3_b2_a_idx (actual rows=0.00 loops=1)
|
-> Bitmap Index Scan on ab_a3_b2_a_idx (actual rows=0.00 loops=1)
|
||||||
Index Cond: (a = (InitPlan 1).col1)
|
Index Cond: (a = (InitPlan expr_1).col1)
|
||||||
Index Searches: 1
|
Index Searches: 1
|
||||||
-> Bitmap Heap Scan on ab_a3_b3 ab_9 (never executed)
|
-> Bitmap Heap Scan on ab_a3_b3 ab_9 (never executed)
|
||||||
Recheck Cond: (a = (InitPlan 1).col1)
|
Recheck Cond: (a = (InitPlan expr_1).col1)
|
||||||
Filter: (b = (InitPlan 2).col1)
|
Filter: (b = (InitPlan expr_2).col1)
|
||||||
-> Bitmap Index Scan on ab_a3_b3_a_idx (never executed)
|
-> Bitmap Index Scan on ab_a3_b3_a_idx (never executed)
|
||||||
Index Cond: (a = (InitPlan 1).col1)
|
Index Cond: (a = (InitPlan expr_1).col1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
(61 rows)
|
(61 rows)
|
||||||
|
|
||||||
@@ -2760,45 +2760,45 @@ select * from (select * from ab where a = 1 union all select * from ab) ab where
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
||||||
Append (actual rows=0.00 loops=1)
|
Append (actual rows=0.00 loops=1)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=1.00 loops=1)
|
-> Result (actual rows=1.00 loops=1)
|
||||||
-> Append (actual rows=0.00 loops=1)
|
-> Append (actual rows=0.00 loops=1)
|
||||||
-> Bitmap Heap Scan on ab_a1_b1 ab_11 (actual rows=0.00 loops=1)
|
-> Bitmap Heap Scan on ab_a1_b1 ab_11 (actual rows=0.00 loops=1)
|
||||||
Recheck Cond: (a = 1)
|
Recheck Cond: (a = 1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0.00 loops=1)
|
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0.00 loops=1)
|
||||||
Index Cond: (a = 1)
|
Index Cond: (a = 1)
|
||||||
Index Searches: 1
|
Index Searches: 1
|
||||||
-> Bitmap Heap Scan on ab_a1_b2 ab_12 (never executed)
|
-> Bitmap Heap Scan on ab_a1_b2 ab_12 (never executed)
|
||||||
Recheck Cond: (a = 1)
|
Recheck Cond: (a = 1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Bitmap Index Scan on ab_a1_b2_a_idx (never executed)
|
-> Bitmap Index Scan on ab_a1_b2_a_idx (never executed)
|
||||||
Index Cond: (a = 1)
|
Index Cond: (a = 1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Bitmap Heap Scan on ab_a1_b3 ab_13 (never executed)
|
-> Bitmap Heap Scan on ab_a1_b3 ab_13 (never executed)
|
||||||
Recheck Cond: (a = 1)
|
Recheck Cond: (a = 1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Bitmap Index Scan on ab_a1_b3_a_idx (never executed)
|
-> Bitmap Index Scan on ab_a1_b3_a_idx (never executed)
|
||||||
Index Cond: (a = 1)
|
Index Cond: (a = 1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Seq Scan on ab_a1_b1 ab_1 (actual rows=0.00 loops=1)
|
-> Seq Scan on ab_a1_b1 ab_1 (actual rows=0.00 loops=1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a1_b2 ab_2 (never executed)
|
-> Seq Scan on ab_a1_b2 ab_2 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a1_b3 ab_3 (never executed)
|
-> Seq Scan on ab_a1_b3 ab_3 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a2_b1 ab_4 (actual rows=0.00 loops=1)
|
-> Seq Scan on ab_a2_b1 ab_4 (actual rows=0.00 loops=1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a2_b2 ab_5 (never executed)
|
-> Seq Scan on ab_a2_b2 ab_5 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a2_b3 ab_6 (never executed)
|
-> Seq Scan on ab_a2_b3 ab_6 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a3_b1 ab_7 (actual rows=0.00 loops=1)
|
-> Seq Scan on ab_a3_b1 ab_7 (actual rows=0.00 loops=1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a3_b2 ab_8 (never executed)
|
-> Seq Scan on ab_a3_b2 ab_8 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a3_b3 ab_9 (never executed)
|
-> Seq Scan on ab_a3_b3 ab_9 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
(40 rows)
|
(40 rows)
|
||||||
|
|
||||||
-- A case containing a UNION ALL with a non-partitioned child.
|
-- A case containing a UNION ALL with a non-partitioned child.
|
||||||
@@ -2807,47 +2807,47 @@ select * from (select * from ab where a = 1 union all (values(10,5)) union all s
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
||||||
Append (actual rows=0.00 loops=1)
|
Append (actual rows=0.00 loops=1)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=1.00 loops=1)
|
-> Result (actual rows=1.00 loops=1)
|
||||||
-> Append (actual rows=0.00 loops=1)
|
-> Append (actual rows=0.00 loops=1)
|
||||||
-> Bitmap Heap Scan on ab_a1_b1 ab_11 (actual rows=0.00 loops=1)
|
-> Bitmap Heap Scan on ab_a1_b1 ab_11 (actual rows=0.00 loops=1)
|
||||||
Recheck Cond: (a = 1)
|
Recheck Cond: (a = 1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0.00 loops=1)
|
-> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0.00 loops=1)
|
||||||
Index Cond: (a = 1)
|
Index Cond: (a = 1)
|
||||||
Index Searches: 1
|
Index Searches: 1
|
||||||
-> Bitmap Heap Scan on ab_a1_b2 ab_12 (never executed)
|
-> Bitmap Heap Scan on ab_a1_b2 ab_12 (never executed)
|
||||||
Recheck Cond: (a = 1)
|
Recheck Cond: (a = 1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Bitmap Index Scan on ab_a1_b2_a_idx (never executed)
|
-> Bitmap Index Scan on ab_a1_b2_a_idx (never executed)
|
||||||
Index Cond: (a = 1)
|
Index Cond: (a = 1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Bitmap Heap Scan on ab_a1_b3 ab_13 (never executed)
|
-> Bitmap Heap Scan on ab_a1_b3 ab_13 (never executed)
|
||||||
Recheck Cond: (a = 1)
|
Recheck Cond: (a = 1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Bitmap Index Scan on ab_a1_b3_a_idx (never executed)
|
-> Bitmap Index Scan on ab_a1_b3_a_idx (never executed)
|
||||||
Index Cond: (a = 1)
|
Index Cond: (a = 1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Result (actual rows=0.00 loops=1)
|
-> Result (actual rows=0.00 loops=1)
|
||||||
One-Time Filter: (5 = (InitPlan 1).col1)
|
One-Time Filter: (5 = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a1_b1 ab_1 (actual rows=0.00 loops=1)
|
-> Seq Scan on ab_a1_b1 ab_1 (actual rows=0.00 loops=1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a1_b2 ab_2 (never executed)
|
-> Seq Scan on ab_a1_b2 ab_2 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a1_b3 ab_3 (never executed)
|
-> Seq Scan on ab_a1_b3 ab_3 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a2_b1 ab_4 (actual rows=0.00 loops=1)
|
-> Seq Scan on ab_a2_b1 ab_4 (actual rows=0.00 loops=1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a2_b2 ab_5 (never executed)
|
-> Seq Scan on ab_a2_b2 ab_5 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a2_b3 ab_6 (never executed)
|
-> Seq Scan on ab_a2_b3 ab_6 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a3_b1 ab_7 (actual rows=0.00 loops=1)
|
-> Seq Scan on ab_a3_b1 ab_7 (actual rows=0.00 loops=1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a3_b2 ab_8 (never executed)
|
-> Seq Scan on ab_a3_b2 ab_8 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a3_b3 ab_9 (never executed)
|
-> Seq Scan on ab_a3_b3 ab_9 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
(42 rows)
|
(42 rows)
|
||||||
|
|
||||||
-- Another UNION ALL test, but containing a mix of exec init and exec run-time pruning.
|
-- Another UNION ALL test, but containing a mix of exec init and exec run-time pruning.
|
||||||
@@ -2865,27 +2865,27 @@ union all
|
|||||||
) ab where a = $1 and b = (select -10);
|
) ab where a = $1 and b = (select -10);
|
||||||
-- Ensure the xy_1 subplan is not pruned.
|
-- Ensure the xy_1 subplan is not pruned.
|
||||||
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q6(1);
|
explain (analyze, costs off, summary off, timing off, buffers off) execute ab_q6(1);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
Append (actual rows=0.00 loops=1)
|
Append (actual rows=0.00 loops=1)
|
||||||
Subplans Removed: 12
|
Subplans Removed: 12
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=1.00 loops=1)
|
-> Result (actual rows=1.00 loops=1)
|
||||||
-> Seq Scan on ab_a1_b1 ab_1 (never executed)
|
-> Seq Scan on ab_a1_b1 ab_1 (never executed)
|
||||||
Filter: ((a = $1) AND (b = (InitPlan 1).col1))
|
Filter: ((a = $1) AND (b = (InitPlan expr_1).col1))
|
||||||
-> Seq Scan on ab_a1_b2 ab_2 (never executed)
|
-> Seq Scan on ab_a1_b2 ab_2 (never executed)
|
||||||
Filter: ((a = $1) AND (b = (InitPlan 1).col1))
|
Filter: ((a = $1) AND (b = (InitPlan expr_1).col1))
|
||||||
-> Seq Scan on ab_a1_b3 ab_3 (never executed)
|
-> Seq Scan on ab_a1_b3 ab_3 (never executed)
|
||||||
Filter: ((a = $1) AND (b = (InitPlan 1).col1))
|
Filter: ((a = $1) AND (b = (InitPlan expr_1).col1))
|
||||||
-> Seq Scan on xy_1 (actual rows=0.00 loops=1)
|
-> Seq Scan on xy_1 (actual rows=0.00 loops=1)
|
||||||
Filter: ((x = $1) AND (y = (InitPlan 1).col1))
|
Filter: ((x = $1) AND (y = (InitPlan expr_1).col1))
|
||||||
Rows Removed by Filter: 1
|
Rows Removed by Filter: 1
|
||||||
-> Seq Scan on ab_a1_b1 ab_4 (never executed)
|
-> Seq Scan on ab_a1_b1 ab_4 (never executed)
|
||||||
Filter: ((a = $1) AND (b = (InitPlan 1).col1))
|
Filter: ((a = $1) AND (b = (InitPlan expr_1).col1))
|
||||||
-> Seq Scan on ab_a1_b2 ab_5 (never executed)
|
-> Seq Scan on ab_a1_b2 ab_5 (never executed)
|
||||||
Filter: ((a = $1) AND (b = (InitPlan 1).col1))
|
Filter: ((a = $1) AND (b = (InitPlan expr_1).col1))
|
||||||
-> Seq Scan on ab_a1_b3 ab_6 (never executed)
|
-> Seq Scan on ab_a1_b3 ab_6 (never executed)
|
||||||
Filter: ((a = $1) AND (b = (InitPlan 1).col1))
|
Filter: ((a = $1) AND (b = (InitPlan expr_1).col1))
|
||||||
(19 rows)
|
(19 rows)
|
||||||
|
|
||||||
-- Ensure we see just the xy_1 row.
|
-- Ensure we see just the xy_1 row.
|
||||||
@@ -2971,7 +2971,7 @@ update ab_a1 set b = 3 from ab_a2 where ab_a2.b = (select 1);');
|
|||||||
Update on ab_a1_b1 ab_a1_1
|
Update on ab_a1_b1 ab_a1_1
|
||||||
Update on ab_a1_b2 ab_a1_2
|
Update on ab_a1_b2 ab_a1_2
|
||||||
Update on ab_a1_b3 ab_a1_3
|
Update on ab_a1_b3 ab_a1_3
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=1.00 loops=1)
|
-> Result (actual rows=1.00 loops=1)
|
||||||
-> Nested Loop (actual rows=3.00 loops=1)
|
-> Nested Loop (actual rows=3.00 loops=1)
|
||||||
-> Append (actual rows=3.00 loops=1)
|
-> Append (actual rows=3.00 loops=1)
|
||||||
@@ -2982,11 +2982,11 @@ update ab_a1 set b = 3 from ab_a2 where ab_a2.b = (select 1);');
|
|||||||
Storage: Memory Maximum Storage: NkB
|
Storage: Memory Maximum Storage: NkB
|
||||||
-> Append (actual rows=1.00 loops=1)
|
-> Append (actual rows=1.00 loops=1)
|
||||||
-> Seq Scan on ab_a2_b1 ab_a2_1 (actual rows=1.00 loops=1)
|
-> Seq Scan on ab_a2_b1 ab_a2_1 (actual rows=1.00 loops=1)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a2_b2 ab_a2_2 (never executed)
|
-> Seq Scan on ab_a2_b2 ab_a2_2 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on ab_a2_b3 ab_a2_3 (never executed)
|
-> Seq Scan on ab_a2_b3 ab_a2_3 (never executed)
|
||||||
Filter: (b = (InitPlan 1).col1)
|
Filter: (b = (InitPlan expr_1).col1)
|
||||||
(20 rows)
|
(20 rows)
|
||||||
|
|
||||||
select tableoid::regclass, * from ab;
|
select tableoid::regclass, * from ab;
|
||||||
@@ -3356,12 +3356,12 @@ select * from listp where a = (select null::int);
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
Append (actual rows=0.00 loops=1)
|
Append (actual rows=0.00 loops=1)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=1.00 loops=1)
|
-> Result (actual rows=1.00 loops=1)
|
||||||
-> Seq Scan on listp_1_1 listp_1 (never executed)
|
-> Seq Scan on listp_1_1 listp_1 (never executed)
|
||||||
Filter: (a = (InitPlan 1).col1)
|
Filter: (a = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on listp_2_1 listp_2 (never executed)
|
-> Seq Scan on listp_2_1 listp_2 (never executed)
|
||||||
Filter: (a = (InitPlan 1).col1)
|
Filter: (a = (InitPlan expr_1).col1)
|
||||||
(7 rows)
|
(7 rows)
|
||||||
|
|
||||||
drop table listp;
|
drop table listp;
|
||||||
@@ -3500,14 +3500,14 @@ prepare ps1 as
|
|||||||
select * from mc3p where a = $1 and abs(b) < (select 3);
|
select * from mc3p where a = $1 and abs(b) < (select 3);
|
||||||
explain (analyze, costs off, summary off, timing off, buffers off)
|
explain (analyze, costs off, summary off, timing off, buffers off)
|
||||||
execute ps1(1);
|
execute ps1(1);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
Append (actual rows=1.00 loops=1)
|
Append (actual rows=1.00 loops=1)
|
||||||
Subplans Removed: 2
|
Subplans Removed: 2
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=1.00 loops=1)
|
-> Result (actual rows=1.00 loops=1)
|
||||||
-> Seq Scan on mc3p1 mc3p_1 (actual rows=1.00 loops=1)
|
-> Seq Scan on mc3p1 mc3p_1 (actual rows=1.00 loops=1)
|
||||||
Filter: ((a = $1) AND (abs(b) < (InitPlan 1).col1))
|
Filter: ((a = $1) AND (abs(b) < (InitPlan expr_1).col1))
|
||||||
(6 rows)
|
(6 rows)
|
||||||
|
|
||||||
deallocate ps1;
|
deallocate ps1;
|
||||||
@@ -3515,16 +3515,16 @@ prepare ps2 as
|
|||||||
select * from mc3p where a <= $1 and abs(b) < (select 3);
|
select * from mc3p where a <= $1 and abs(b) < (select 3);
|
||||||
explain (analyze, costs off, summary off, timing off, buffers off)
|
explain (analyze, costs off, summary off, timing off, buffers off)
|
||||||
execute ps2(1);
|
execute ps2(1);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Append (actual rows=2.00 loops=1)
|
Append (actual rows=2.00 loops=1)
|
||||||
Subplans Removed: 1
|
Subplans Removed: 1
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=1.00 loops=1)
|
-> Result (actual rows=1.00 loops=1)
|
||||||
-> Seq Scan on mc3p0 mc3p_1 (actual rows=1.00 loops=1)
|
-> Seq Scan on mc3p0 mc3p_1 (actual rows=1.00 loops=1)
|
||||||
Filter: ((a <= $1) AND (abs(b) < (InitPlan 1).col1))
|
Filter: ((a <= $1) AND (abs(b) < (InitPlan expr_1).col1))
|
||||||
-> Seq Scan on mc3p1 mc3p_2 (actual rows=1.00 loops=1)
|
-> Seq Scan on mc3p1 mc3p_2 (actual rows=1.00 loops=1)
|
||||||
Filter: ((a <= $1) AND (abs(b) < (InitPlan 1).col1))
|
Filter: ((a <= $1) AND (abs(b) < (InitPlan expr_1).col1))
|
||||||
(8 rows)
|
(8 rows)
|
||||||
|
|
||||||
deallocate ps2;
|
deallocate ps2;
|
||||||
@@ -3540,14 +3540,14 @@ select * from boolp where a = (select value from boolvalues where value);
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
Append (actual rows=0.00 loops=1)
|
Append (actual rows=0.00 loops=1)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Seq Scan on boolvalues (actual rows=1.00 loops=1)
|
-> Seq Scan on boolvalues (actual rows=1.00 loops=1)
|
||||||
Filter: value
|
Filter: value
|
||||||
Rows Removed by Filter: 1
|
Rows Removed by Filter: 1
|
||||||
-> Seq Scan on boolp_f boolp_1 (never executed)
|
-> Seq Scan on boolp_f boolp_1 (never executed)
|
||||||
Filter: (a = (InitPlan 1).col1)
|
Filter: (a = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on boolp_t boolp_2 (actual rows=0.00 loops=1)
|
-> Seq Scan on boolp_t boolp_2 (actual rows=0.00 loops=1)
|
||||||
Filter: (a = (InitPlan 1).col1)
|
Filter: (a = (InitPlan expr_1).col1)
|
||||||
(9 rows)
|
(9 rows)
|
||||||
|
|
||||||
explain (analyze, costs off, summary off, timing off, buffers off)
|
explain (analyze, costs off, summary off, timing off, buffers off)
|
||||||
@@ -3555,14 +3555,14 @@ select * from boolp where a = (select value from boolvalues where not value);
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
Append (actual rows=0.00 loops=1)
|
Append (actual rows=0.00 loops=1)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Seq Scan on boolvalues (actual rows=1.00 loops=1)
|
-> Seq Scan on boolvalues (actual rows=1.00 loops=1)
|
||||||
Filter: (NOT value)
|
Filter: (NOT value)
|
||||||
Rows Removed by Filter: 1
|
Rows Removed by Filter: 1
|
||||||
-> Seq Scan on boolp_f boolp_1 (actual rows=0.00 loops=1)
|
-> Seq Scan on boolp_f boolp_1 (actual rows=0.00 loops=1)
|
||||||
Filter: (a = (InitPlan 1).col1)
|
Filter: (a = (InitPlan expr_1).col1)
|
||||||
-> Seq Scan on boolp_t boolp_2 (never executed)
|
-> Seq Scan on boolp_t boolp_2 (never executed)
|
||||||
Filter: (a = (InitPlan 1).col1)
|
Filter: (a = (InitPlan expr_1).col1)
|
||||||
(9 rows)
|
(9 rows)
|
||||||
|
|
||||||
drop table boolp;
|
drop table boolp;
|
||||||
@@ -3654,22 +3654,22 @@ explain (analyze, costs off, summary off, timing off, buffers off) select * from
|
|||||||
--------------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------
|
||||||
Merge Append (actual rows=20.00 loops=1)
|
Merge Append (actual rows=20.00 loops=1)
|
||||||
Sort Key: ma_test.b
|
Sort Key: ma_test.b
|
||||||
InitPlan 2
|
InitPlan expr_1
|
||||||
-> Result (actual rows=1.00 loops=1)
|
-> Result (actual rows=1.00 loops=1)
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit (actual rows=1.00 loops=1)
|
-> Limit (actual rows=1.00 loops=1)
|
||||||
-> Index Scan using ma_test_p2_b_idx on ma_test_p2 (actual rows=1.00 loops=1)
|
-> Index Scan using ma_test_p2_b_idx on ma_test_p2 (actual rows=1.00 loops=1)
|
||||||
Index Cond: (b IS NOT NULL)
|
Index Cond: (b IS NOT NULL)
|
||||||
Index Searches: 1
|
Index Searches: 1
|
||||||
-> Index Scan using ma_test_p1_b_idx on ma_test_p1 ma_test_1 (never executed)
|
-> Index Scan using ma_test_p1_b_idx on ma_test_p1 ma_test_1 (never executed)
|
||||||
Filter: (a >= (InitPlan 2).col1)
|
Filter: (a >= (InitPlan expr_1).col1)
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Index Scan using ma_test_p2_b_idx on ma_test_p2 ma_test_2 (actual rows=10.00 loops=1)
|
-> Index Scan using ma_test_p2_b_idx on ma_test_p2 ma_test_2 (actual rows=10.00 loops=1)
|
||||||
Filter: (a >= (InitPlan 2).col1)
|
Filter: (a >= (InitPlan expr_1).col1)
|
||||||
Index Searches: 1
|
Index Searches: 1
|
||||||
-> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_3 (actual rows=10.00 loops=1)
|
-> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_3 (actual rows=10.00 loops=1)
|
||||||
Filter: (a >= (InitPlan 2).col1)
|
Filter: (a >= (InitPlan expr_1).col1)
|
||||||
Index Searches: 1
|
Index Searches: 1
|
||||||
(19 rows)
|
(19 rows)
|
||||||
|
|
||||||
@@ -4043,17 +4043,17 @@ from (
|
|||||||
select 1, 1, 1
|
select 1, 1, 1
|
||||||
) s(a, b, c)
|
) s(a, b, c)
|
||||||
where s.a = 1 and s.b = 1 and s.c = (select 1);
|
where s.a = 1 and s.b = 1 and s.c = (select 1);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
Append
|
Append
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
-> Seq Scan on p1 p
|
-> Seq Scan on p1 p
|
||||||
Filter: ((a = 1) AND (b = 1) AND (c = (InitPlan 1).col1))
|
Filter: ((a = 1) AND (b = 1) AND (c = (InitPlan expr_1).col1))
|
||||||
-> Seq Scan on q111 q1
|
-> Seq Scan on q111 q1
|
||||||
Filter: ((a = 1) AND (b = 1) AND (c = (InitPlan 1).col1))
|
Filter: ((a = 1) AND (b = 1) AND (c = (InitPlan expr_1).col1))
|
||||||
-> Result
|
-> Result
|
||||||
One-Time Filter: (1 = (InitPlan 1).col1)
|
One-Time Filter: (1 = (InitPlan expr_1).col1)
|
||||||
(9 rows)
|
(9 rows)
|
||||||
|
|
||||||
select *
|
select *
|
||||||
@@ -4081,18 +4081,18 @@ from (
|
|||||||
) s(a, b, c)
|
) s(a, b, c)
|
||||||
where s.a = $1 and s.b = $2 and s.c = (select 1);
|
where s.a = $1 and s.b = $2 and s.c = (select 1);
|
||||||
explain (costs off) execute q (1, 1);
|
explain (costs off) execute q (1, 1);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------
|
||||||
Append
|
Append
|
||||||
Subplans Removed: 1
|
Subplans Removed: 1
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
-> Seq Scan on p1 p
|
-> Seq Scan on p1 p
|
||||||
Filter: ((a = $1) AND (b = $2) AND (c = (InitPlan 1).col1))
|
Filter: ((a = $1) AND (b = $2) AND (c = (InitPlan expr_1).col1))
|
||||||
-> Seq Scan on q111 q1
|
-> Seq Scan on q111 q1
|
||||||
Filter: ((a = $1) AND (b = $2) AND (c = (InitPlan 1).col1))
|
Filter: ((a = $1) AND (b = $2) AND (c = (InitPlan expr_1).col1))
|
||||||
-> Result
|
-> Result
|
||||||
One-Time Filter: ((1 = $1) AND (1 = $2) AND (1 = (InitPlan 1).col1))
|
One-Time Filter: ((1 = $1) AND (1 = $2) AND (1 = (InitPlan expr_1).col1))
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
execute q (1, 1);
|
execute q (1, 1);
|
||||||
@@ -4110,11 +4110,11 @@ create table listp2 partition of listp for values in(2) partition by list(b);
|
|||||||
create table listp2_10 partition of listp2 for values in (10);
|
create table listp2_10 partition of listp2 for values in (10);
|
||||||
explain (analyze, costs off, summary off, timing off, buffers off)
|
explain (analyze, costs off, summary off, timing off, buffers off)
|
||||||
select * from listp where a = (select 2) and b <> 10;
|
select * from listp where a = (select 2) and b <> 10;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------
|
--------------------------------------------------------
|
||||||
Seq Scan on listp1 listp (actual rows=0.00 loops=1)
|
Seq Scan on listp1 listp (actual rows=0.00 loops=1)
|
||||||
Filter: ((b <> 10) AND (a = (InitPlan 1).col1))
|
Filter: ((b <> 10) AND (a = (InitPlan expr_1).col1))
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (never executed)
|
-> Result (never executed)
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
@@ -4182,13 +4182,13 @@ select explain_parallel_append('select * from listp where a = (select 1);');
|
|||||||
Gather (actual rows=N loops=N)
|
Gather (actual rows=N loops=N)
|
||||||
Workers Planned: 2
|
Workers Planned: 2
|
||||||
Workers Launched: N
|
Workers Launched: N
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=N loops=N)
|
-> Result (actual rows=N loops=N)
|
||||||
-> Parallel Append (actual rows=N loops=N)
|
-> Parallel Append (actual rows=N loops=N)
|
||||||
-> Seq Scan on listp_12_1 listp_1 (actual rows=N loops=N)
|
-> Seq Scan on listp_12_1 listp_1 (actual rows=N loops=N)
|
||||||
Filter: (a = (InitPlan 1).col1)
|
Filter: (a = (InitPlan expr_1).col1)
|
||||||
-> Parallel Seq Scan on listp_12_2 listp_2 (never executed)
|
-> Parallel Seq Scan on listp_12_2 listp_2 (never executed)
|
||||||
Filter: (a = (InitPlan 1).col1)
|
Filter: (a = (InitPlan expr_1).col1)
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
-- Like the above but throw some more complexity at the planner by adding
|
-- Like the above but throw some more complexity at the planner by adding
|
||||||
@@ -4205,19 +4205,19 @@ select * from listp where a = (select 2);');
|
|||||||
Workers Launched: N
|
Workers Launched: N
|
||||||
-> Parallel Append (actual rows=N loops=N)
|
-> Parallel Append (actual rows=N loops=N)
|
||||||
-> Parallel Append (actual rows=N loops=N)
|
-> Parallel Append (actual rows=N loops=N)
|
||||||
InitPlan 2
|
InitPlan expr_2
|
||||||
-> Result (actual rows=N loops=N)
|
-> Result (actual rows=N loops=N)
|
||||||
-> Seq Scan on listp_12_1 listp_1 (never executed)
|
-> Seq Scan on listp_12_1 listp_1 (never executed)
|
||||||
Filter: (a = (InitPlan 2).col1)
|
Filter: (a = (InitPlan expr_2).col1)
|
||||||
-> Parallel Seq Scan on listp_12_2 listp_2 (actual rows=N loops=N)
|
-> Parallel Seq Scan on listp_12_2 listp_2 (actual rows=N loops=N)
|
||||||
Filter: (a = (InitPlan 2).col1)
|
Filter: (a = (InitPlan expr_2).col1)
|
||||||
-> Parallel Append (actual rows=N loops=N)
|
-> Parallel Append (actual rows=N loops=N)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=N loops=N)
|
-> Result (actual rows=N loops=N)
|
||||||
-> Seq Scan on listp_12_1 listp_4 (actual rows=N loops=N)
|
-> Seq Scan on listp_12_1 listp_4 (actual rows=N loops=N)
|
||||||
Filter: (a = (InitPlan 1).col1)
|
Filter: (a = (InitPlan expr_1).col1)
|
||||||
-> Parallel Seq Scan on listp_12_2 listp_5 (never executed)
|
-> Parallel Seq Scan on listp_12_2 listp_5 (never executed)
|
||||||
Filter: (a = (InitPlan 1).col1)
|
Filter: (a = (InitPlan expr_1).col1)
|
||||||
(18 rows)
|
(18 rows)
|
||||||
|
|
||||||
drop table listp;
|
drop table listp;
|
||||||
@@ -4240,23 +4240,23 @@ select * from rangep where b IN((select 1),(select 2)) order by a;
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------------
|
||||||
Append (actual rows=0.00 loops=1)
|
Append (actual rows=0.00 loops=1)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result (actual rows=1.00 loops=1)
|
-> Result (actual rows=1.00 loops=1)
|
||||||
InitPlan 2
|
InitPlan expr_2
|
||||||
-> Result (actual rows=1.00 loops=1)
|
-> Result (actual rows=1.00 loops=1)
|
||||||
-> Merge Append (actual rows=0.00 loops=1)
|
-> Merge Append (actual rows=0.00 loops=1)
|
||||||
Sort Key: rangep_2.a
|
Sort Key: rangep_2.a
|
||||||
-> Index Scan using rangep_0_to_100_1_a_idx on rangep_0_to_100_1 rangep_2 (actual rows=0.00 loops=1)
|
-> Index Scan using rangep_0_to_100_1_a_idx on rangep_0_to_100_1 rangep_2 (actual rows=0.00 loops=1)
|
||||||
Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col1]))
|
Filter: (b = ANY (ARRAY[(InitPlan expr_1).col1, (InitPlan expr_2).col1]))
|
||||||
Index Searches: 1
|
Index Searches: 1
|
||||||
-> Index Scan using rangep_0_to_100_2_a_idx on rangep_0_to_100_2 rangep_3 (actual rows=0.00 loops=1)
|
-> Index Scan using rangep_0_to_100_2_a_idx on rangep_0_to_100_2 rangep_3 (actual rows=0.00 loops=1)
|
||||||
Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col1]))
|
Filter: (b = ANY (ARRAY[(InitPlan expr_1).col1, (InitPlan expr_2).col1]))
|
||||||
Index Searches: 1
|
Index Searches: 1
|
||||||
-> Index Scan using rangep_0_to_100_3_a_idx on rangep_0_to_100_3 rangep_4 (never executed)
|
-> Index Scan using rangep_0_to_100_3_a_idx on rangep_0_to_100_3 rangep_4 (never executed)
|
||||||
Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col1]))
|
Filter: (b = ANY (ARRAY[(InitPlan expr_1).col1, (InitPlan expr_2).col1]))
|
||||||
Index Searches: 0
|
Index Searches: 0
|
||||||
-> Index Scan using rangep_100_to_200_a_idx on rangep_100_to_200 rangep_5 (actual rows=0.00 loops=1)
|
-> Index Scan using rangep_100_to_200_a_idx on rangep_100_to_200 rangep_5 (actual rows=0.00 loops=1)
|
||||||
Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col1]))
|
Filter: (b = ANY (ARRAY[(InitPlan expr_1).col1, (InitPlan expr_2).col1]))
|
||||||
Index Searches: 1
|
Index Searches: 1
|
||||||
(19 rows)
|
(19 rows)
|
||||||
|
|
||||||
|
@@ -1472,18 +1472,18 @@ rollback;
|
|||||||
-- Check handling of non-backwards-scan-capable plans with scroll cursors
|
-- Check handling of non-backwards-scan-capable plans with scroll cursors
|
||||||
begin;
|
begin;
|
||||||
explain (costs off) declare c1 cursor for select (select 42) as x;
|
explain (costs off) declare c1 cursor for select (select 42) as x;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------
|
-------------------
|
||||||
Result
|
Result
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
(3 rows)
|
(3 rows)
|
||||||
|
|
||||||
explain (costs off) declare c1 scroll cursor for select (select 42) as x;
|
explain (costs off) declare c1 scroll cursor for select (select 42) as x;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------
|
-------------------
|
||||||
Materialize
|
Materialize
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
-> Result
|
-> Result
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
@@ -247,11 +247,11 @@ SELECT * FROM pred_tab t1
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
Nested Loop Left Join
|
Nested Loop Left Join
|
||||||
Join Filter: EXISTS(SubPlan 1)
|
Join Filter: EXISTS(SubPlan exists_1)
|
||||||
-> Seq Scan on pred_tab t1
|
-> Seq Scan on pred_tab t1
|
||||||
-> Materialize
|
-> Materialize
|
||||||
-> Seq Scan on pred_tab t2
|
-> Seq Scan on pred_tab t2
|
||||||
SubPlan 1
|
SubPlan exists_1
|
||||||
-> Nested Loop
|
-> Nested Loop
|
||||||
-> Nested Loop
|
-> Nested Loop
|
||||||
-> Nested Loop
|
-> Nested Loop
|
||||||
@@ -274,8 +274,8 @@ SELECT * FROM pred_tab t1
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
Nested Loop Left Join
|
Nested Loop Left Join
|
||||||
Join Filter: (InitPlan 1).col1
|
Join Filter: (InitPlan exists_1).col1
|
||||||
InitPlan 1
|
InitPlan exists_1
|
||||||
-> Result
|
-> Result
|
||||||
Replaces: Join on t3, t4, t5, t6
|
Replaces: Join on t3, t4, t5, t6
|
||||||
One-Time Filter: false
|
One-Time Filter: false
|
||||||
|
@@ -548,16 +548,16 @@ INSERT INTO foo VALUES (5, 'subquery test')
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
Insert on pg_temp.foo
|
Insert on pg_temp.foo
|
||||||
Output: (SubPlan 1), (SubPlan 2)
|
Output: (SubPlan expr_1), (SubPlan expr_2)
|
||||||
-> Result
|
-> Result
|
||||||
Output: 5, 'subquery test'::text, 42, '99'::bigint
|
Output: 5, 'subquery test'::text, 42, '99'::bigint
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Output: max((old.f4 + x.x))
|
Output: max((old.f4 + x.x))
|
||||||
-> Function Scan on pg_catalog.generate_series x
|
-> Function Scan on pg_catalog.generate_series x
|
||||||
Output: x.x
|
Output: x.x
|
||||||
Function Call: generate_series(1, 10)
|
Function Call: generate_series(1, 10)
|
||||||
SubPlan 2
|
SubPlan expr_2
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Output: max((new.f4 + x_1.x))
|
Output: max((new.f4 + x_1.x))
|
||||||
-> Function Scan on pg_catalog.generate_series x_1
|
-> Function Scan on pg_catalog.generate_series x_1
|
||||||
@@ -578,26 +578,26 @@ UPDATE foo SET f4 = 100 WHERE f1 = 5
|
|||||||
RETURNING (SELECT old.f4 = new.f4),
|
RETURNING (SELECT old.f4 = new.f4),
|
||||||
(SELECT max(old.f4 + x) FROM generate_series(1, 10) x) old_max,
|
(SELECT max(old.f4 + x) FROM generate_series(1, 10) x) old_max,
|
||||||
(SELECT max(new.f4 + x) FROM generate_series(1, 10) x) new_max;
|
(SELECT max(new.f4 + x) FROM generate_series(1, 10) x) new_max;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
Update on pg_temp.foo
|
Update on pg_temp.foo
|
||||||
Output: (SubPlan 1), (SubPlan 2), (SubPlan 3)
|
Output: (SubPlan expr_1), (SubPlan expr_2), (SubPlan expr_3)
|
||||||
Update on pg_temp.foo foo_1
|
Update on pg_temp.foo foo_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: '100'::bigint, foo_1.tableoid, foo_1.ctid
|
Output: '100'::bigint, foo_1.tableoid, foo_1.ctid
|
||||||
-> Seq Scan on pg_temp.foo foo_1
|
-> Seq Scan on pg_temp.foo foo_1
|
||||||
Output: foo_1.tableoid, foo_1.ctid
|
Output: foo_1.tableoid, foo_1.ctid
|
||||||
Filter: (foo_1.f1 = 5)
|
Filter: (foo_1.f1 = 5)
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: (old.f4 = new.f4)
|
Output: (old.f4 = new.f4)
|
||||||
SubPlan 2
|
SubPlan expr_2
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Output: max((old.f4 + x.x))
|
Output: max((old.f4 + x.x))
|
||||||
-> Function Scan on pg_catalog.generate_series x
|
-> Function Scan on pg_catalog.generate_series x
|
||||||
Output: x.x
|
Output: x.x
|
||||||
Function Call: generate_series(1, 10)
|
Function Call: generate_series(1, 10)
|
||||||
SubPlan 3
|
SubPlan expr_3
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Output: max((new.f4 + x_1.x))
|
Output: max((new.f4 + x_1.x))
|
||||||
-> Function Scan on pg_catalog.generate_series x_1
|
-> Function Scan on pg_catalog.generate_series x_1
|
||||||
@@ -621,18 +621,18 @@ DELETE FROM foo WHERE f1 = 5
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
Delete on pg_temp.foo
|
Delete on pg_temp.foo
|
||||||
Output: (SubPlan 1), (SubPlan 2)
|
Output: (SubPlan expr_1), (SubPlan expr_2)
|
||||||
Delete on pg_temp.foo foo_1
|
Delete on pg_temp.foo foo_1
|
||||||
-> Seq Scan on pg_temp.foo foo_1
|
-> Seq Scan on pg_temp.foo foo_1
|
||||||
Output: foo_1.tableoid, foo_1.ctid
|
Output: foo_1.tableoid, foo_1.ctid
|
||||||
Filter: (foo_1.f1 = 5)
|
Filter: (foo_1.f1 = 5)
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Output: max((old.f4 + x.x))
|
Output: max((old.f4 + x.x))
|
||||||
-> Function Scan on pg_catalog.generate_series x
|
-> Function Scan on pg_catalog.generate_series x
|
||||||
Output: x.x
|
Output: x.x
|
||||||
Function Call: generate_series(1, 10)
|
Function Call: generate_series(1, 10)
|
||||||
SubPlan 2
|
SubPlan expr_2
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Output: max((new.f4 + x_1.x))
|
Output: max((new.f4 + x_1.x))
|
||||||
-> Function Scan on pg_catalog.generate_series x_1
|
-> Function Scan on pg_catalog.generate_series x_1
|
||||||
|
@@ -265,27 +265,27 @@ NOTICE: f_leak => awesome science fiction
|
|||||||
(5 rows)
|
(5 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM document WHERE f_leak(dtitle);
|
EXPLAIN (COSTS OFF) SELECT * FROM document WHERE f_leak(dtitle);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Seq Scan on document
|
Seq Scan on document
|
||||||
Filter: ((dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Index Scan using uaccount_pkey on uaccount
|
-> Index Scan using uaccount_pkey on uaccount
|
||||||
Index Cond: (pguser = CURRENT_USER)
|
Index Cond: (pguser = CURRENT_USER)
|
||||||
(5 rows)
|
(5 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle);
|
EXPLAIN (COSTS OFF) SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Hash Join
|
Hash Join
|
||||||
Hash Cond: (category.cid = document.cid)
|
Hash Cond: (category.cid = document.cid)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Index Scan using uaccount_pkey on uaccount
|
-> Index Scan using uaccount_pkey on uaccount
|
||||||
Index Cond: (pguser = CURRENT_USER)
|
Index Cond: (pguser = CURRENT_USER)
|
||||||
-> Seq Scan on category
|
-> Seq Scan on category
|
||||||
-> Hash
|
-> Hash
|
||||||
-> Seq Scan on document
|
-> Seq Scan on document
|
||||||
Filter: ((dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
(9 rows)
|
(9 rows)
|
||||||
|
|
||||||
-- viewpoint from regress_rls_dave
|
-- viewpoint from regress_rls_dave
|
||||||
@@ -329,27 +329,27 @@ NOTICE: f_leak => awesome technology book
|
|||||||
(7 rows)
|
(7 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM document WHERE f_leak(dtitle);
|
EXPLAIN (COSTS OFF) SELECT * FROM document WHERE f_leak(dtitle);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------
|
||||||
Seq Scan on document
|
Seq Scan on document
|
||||||
Filter: ((cid <> 44) AND (cid <> 44) AND (cid < 50) AND (dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((cid <> 44) AND (cid <> 44) AND (cid < 50) AND (dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Index Scan using uaccount_pkey on uaccount
|
-> Index Scan using uaccount_pkey on uaccount
|
||||||
Index Cond: (pguser = CURRENT_USER)
|
Index Cond: (pguser = CURRENT_USER)
|
||||||
(5 rows)
|
(5 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle);
|
EXPLAIN (COSTS OFF) SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------
|
||||||
Hash Join
|
Hash Join
|
||||||
Hash Cond: (category.cid = document.cid)
|
Hash Cond: (category.cid = document.cid)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Index Scan using uaccount_pkey on uaccount
|
-> Index Scan using uaccount_pkey on uaccount
|
||||||
Index Cond: (pguser = CURRENT_USER)
|
Index Cond: (pguser = CURRENT_USER)
|
||||||
-> Seq Scan on category
|
-> Seq Scan on category
|
||||||
-> Hash
|
-> Hash
|
||||||
-> Seq Scan on document
|
-> Seq Scan on document
|
||||||
Filter: ((cid <> 44) AND (cid <> 44) AND (cid < 50) AND (dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((cid <> 44) AND (cid <> 44) AND (cid < 50) AND (dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
(9 rows)
|
(9 rows)
|
||||||
|
|
||||||
-- 44 would technically fail for both p2r and p1r, but we should get an error
|
-- 44 would technically fail for both p2r and p1r, but we should get an error
|
||||||
@@ -987,18 +987,18 @@ NOTICE: f_leak => my first satire
|
|||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle);
|
EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
Append
|
Append
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Index Scan using uaccount_pkey on uaccount
|
-> Index Scan using uaccount_pkey on uaccount
|
||||||
Index Cond: (pguser = CURRENT_USER)
|
Index Cond: (pguser = CURRENT_USER)
|
||||||
-> Seq Scan on part_document_fiction part_document_1
|
-> Seq Scan on part_document_fiction part_document_1
|
||||||
Filter: ((dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
-> Seq Scan on part_document_satire part_document_2
|
-> Seq Scan on part_document_satire part_document_2
|
||||||
Filter: ((dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
-> Seq Scan on part_document_nonfiction part_document_3
|
-> Seq Scan on part_document_nonfiction part_document_3
|
||||||
Filter: ((dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
-- viewpoint from regress_rls_carol
|
-- viewpoint from regress_rls_carol
|
||||||
@@ -1029,18 +1029,18 @@ NOTICE: f_leak => awesome technology book
|
|||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle);
|
EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
Append
|
Append
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Index Scan using uaccount_pkey on uaccount
|
-> Index Scan using uaccount_pkey on uaccount
|
||||||
Index Cond: (pguser = CURRENT_USER)
|
Index Cond: (pguser = CURRENT_USER)
|
||||||
-> Seq Scan on part_document_fiction part_document_1
|
-> Seq Scan on part_document_fiction part_document_1
|
||||||
Filter: ((dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
-> Seq Scan on part_document_satire part_document_2
|
-> Seq Scan on part_document_satire part_document_2
|
||||||
Filter: ((dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
-> Seq Scan on part_document_nonfiction part_document_3
|
-> Seq Scan on part_document_nonfiction part_document_3
|
||||||
Filter: ((dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
-- viewpoint from regress_rls_dave
|
-- viewpoint from regress_rls_dave
|
||||||
@@ -1059,11 +1059,11 @@ NOTICE: f_leak => awesome science fiction
|
|||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle);
|
EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
||||||
Seq Scan on part_document_fiction part_document
|
Seq Scan on part_document_fiction part_document
|
||||||
Filter: ((cid < 55) AND (dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((cid < 55) AND (dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Index Scan using uaccount_pkey on uaccount
|
-> Index Scan using uaccount_pkey on uaccount
|
||||||
Index Cond: (pguser = CURRENT_USER)
|
Index Cond: (pguser = CURRENT_USER)
|
||||||
(5 rows)
|
(5 rows)
|
||||||
@@ -1137,11 +1137,11 @@ NOTICE: f_leak => awesome science fiction
|
|||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle);
|
EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
||||||
Seq Scan on part_document_fiction part_document
|
Seq Scan on part_document_fiction part_document
|
||||||
Filter: ((cid < 55) AND (dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((cid < 55) AND (dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Index Scan using uaccount_pkey on uaccount
|
-> Index Scan using uaccount_pkey on uaccount
|
||||||
Index Cond: (pguser = CURRENT_USER)
|
Index Cond: (pguser = CURRENT_USER)
|
||||||
(5 rows)
|
(5 rows)
|
||||||
@@ -1176,18 +1176,18 @@ NOTICE: f_leak => awesome technology book
|
|||||||
(11 rows)
|
(11 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle);
|
EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
Append
|
Append
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Index Scan using uaccount_pkey on uaccount
|
-> Index Scan using uaccount_pkey on uaccount
|
||||||
Index Cond: (pguser = CURRENT_USER)
|
Index Cond: (pguser = CURRENT_USER)
|
||||||
-> Seq Scan on part_document_fiction part_document_1
|
-> Seq Scan on part_document_fiction part_document_1
|
||||||
Filter: ((dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
-> Seq Scan on part_document_satire part_document_2
|
-> Seq Scan on part_document_satire part_document_2
|
||||||
Filter: ((dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
-> Seq Scan on part_document_nonfiction part_document_3
|
-> Seq Scan on part_document_nonfiction part_document_3
|
||||||
Filter: ((dlevel <= (InitPlan 1).col1) AND f_leak(dtitle))
|
Filter: ((dlevel <= (InitPlan expr_1).col1) AND f_leak(dtitle))
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
-- only owner can change policies
|
-- only owner can change policies
|
||||||
@@ -1437,11 +1437,11 @@ NOTICE: f_leak => 03b26944890929ff751653acb2f2af79
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM only s1 WHERE f_leak(b);
|
EXPLAIN (COSTS OFF) SELECT * FROM only s1 WHERE f_leak(b);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Seq Scan on s1
|
Seq Scan on s1
|
||||||
Filter: ((ANY (a = (hashed SubPlan 1).col1)) AND f_leak(b))
|
Filter: ((ANY (a = (hashed SubPlan any_1).col1)) AND f_leak(b))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on s2
|
-> Seq Scan on s2
|
||||||
Filter: (((x % 2) = 0) AND (y ~~ '%2f%'::text))
|
Filter: (((x % 2) = 0) AND (y ~~ '%2f%'::text))
|
||||||
(5 rows)
|
(5 rows)
|
||||||
@@ -1457,11 +1457,11 @@ NOTICE: f_leak => 03b26944890929ff751653acb2f2af79
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM s1 WHERE f_leak(b);
|
EXPLAIN (COSTS OFF) SELECT * FROM s1 WHERE f_leak(b);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Seq Scan on s1
|
Seq Scan on s1
|
||||||
Filter: ((ANY (a = (hashed SubPlan 1).col1)) AND f_leak(b))
|
Filter: ((ANY (a = (hashed SubPlan any_1).col1)) AND f_leak(b))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on s2
|
-> Seq Scan on s2
|
||||||
Filter: (((x % 2) = 0) AND (y ~~ '%af%'::text))
|
Filter: (((x % 2) = 0) AND (y ~~ '%af%'::text))
|
||||||
(5 rows)
|
(5 rows)
|
||||||
@@ -1477,11 +1477,11 @@ EXPLAIN (COSTS OFF) SELECT (SELECT x FROM s1 LIMIT 1) xx, * FROM s2 WHERE y like
|
|||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
Seq Scan on s2
|
Seq Scan on s2
|
||||||
Filter: (((x % 2) = 0) AND (y ~~ '%28%'::text))
|
Filter: (((x % 2) = 0) AND (y ~~ '%28%'::text))
|
||||||
SubPlan 2
|
SubPlan expr_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Seq Scan on s1
|
-> Seq Scan on s1
|
||||||
Filter: (ANY (a = (hashed SubPlan 1).col1))
|
Filter: (ANY (a = (hashed SubPlan any_1).col1))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on s2 s2_1
|
-> Seq Scan on s2 s2_1
|
||||||
Filter: (((x % 2) = 0) AND (y ~~ '%af%'::text))
|
Filter: (((x % 2) = 0) AND (y ~~ '%af%'::text))
|
||||||
(9 rows)
|
(9 rows)
|
||||||
@@ -2717,11 +2717,11 @@ NOTICE: f_leak => bbb
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;
|
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------
|
||||||
Seq Scan on z1
|
Seq Scan on z1
|
||||||
Filter: ((NOT (ANY (a = (hashed SubPlan 1).col1))) AND ((a % 2) = 0) AND f_leak(b))
|
Filter: ((NOT (ANY (a = (hashed SubPlan any_1).col1))) AND ((a % 2) = 0) AND f_leak(b))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on z1_blacklist
|
-> Seq Scan on z1_blacklist
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
@@ -2735,11 +2735,11 @@ NOTICE: f_leak => bbb
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;
|
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------
|
||||||
Seq Scan on z1
|
Seq Scan on z1
|
||||||
Filter: ((NOT (ANY (a = (hashed SubPlan 1).col1))) AND ((a % 2) = 0) AND f_leak(b))
|
Filter: ((NOT (ANY (a = (hashed SubPlan any_1).col1))) AND ((a % 2) = 0) AND f_leak(b))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on z1_blacklist
|
-> Seq Scan on z1_blacklist
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
@@ -2907,11 +2907,11 @@ NOTICE: f_leak => bbb
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;
|
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------
|
||||||
Seq Scan on z1
|
Seq Scan on z1
|
||||||
Filter: ((NOT (ANY (a = (hashed SubPlan 1).col1))) AND ((a % 2) = 0) AND f_leak(b))
|
Filter: ((NOT (ANY (a = (hashed SubPlan any_1).col1))) AND ((a % 2) = 0) AND f_leak(b))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on z1_blacklist
|
-> Seq Scan on z1_blacklist
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
@@ -2933,11 +2933,11 @@ NOTICE: f_leak => aba
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;
|
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------
|
||||||
Seq Scan on z1
|
Seq Scan on z1
|
||||||
Filter: ((NOT (ANY (a = (hashed SubPlan 1).col1))) AND ((a % 2) = 1) AND f_leak(b))
|
Filter: ((NOT (ANY (a = (hashed SubPlan any_1).col1))) AND ((a % 2) = 1) AND f_leak(b))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on z1_blacklist
|
-> Seq Scan on z1_blacklist
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
|
@@ -1251,19 +1251,19 @@ with cte(c) as materialized (select row(1, 2)),
|
|||||||
select * from cte2 as t
|
select * from cte2 as t
|
||||||
where (select * from (select c as c1) s
|
where (select * from (select c as c1) s
|
||||||
where (select (c1).f1 > 0)) is not null;
|
where (select (c1).f1 > 0)) is not null;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------
|
---------------------------------------------------
|
||||||
CTE Scan on cte
|
CTE Scan on cte
|
||||||
Output: cte.c
|
Output: cte.c
|
||||||
Filter: ((SubPlan 3) IS NOT NULL)
|
Filter: ((SubPlan expr_1) IS NOT NULL)
|
||||||
CTE cte
|
CTE cte
|
||||||
-> Result
|
-> Result
|
||||||
Output: '(1,2)'::record
|
Output: '(1,2)'::record
|
||||||
SubPlan 3
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: cte.c
|
Output: cte.c
|
||||||
One-Time Filter: (InitPlan 2).col1
|
One-Time Filter: (InitPlan expr_2).col1
|
||||||
InitPlan 2
|
InitPlan expr_2
|
||||||
-> Result
|
-> Result
|
||||||
Output: ((cte.c).f1 > 0)
|
Output: ((cte.c).f1 > 0)
|
||||||
(13 rows)
|
(13 rows)
|
||||||
|
@@ -156,9 +156,9 @@ explain (costs off)
|
|||||||
-> Parallel Append
|
-> Parallel Append
|
||||||
-> Parallel Seq Scan on part_pa_test_p1 pa2_1
|
-> Parallel Seq Scan on part_pa_test_p1 pa2_1
|
||||||
-> Parallel Seq Scan on part_pa_test_p2 pa2_2
|
-> Parallel Seq Scan on part_pa_test_p2 pa2_2
|
||||||
SubPlan 2
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
SubPlan 1
|
SubPlan expr_2
|
||||||
-> Append
|
-> Append
|
||||||
-> Seq Scan on part_pa_test_p1 pa1_1
|
-> Seq Scan on part_pa_test_p1 pa1_1
|
||||||
Filter: (a = pa2.a)
|
Filter: (a = pa2.a)
|
||||||
@@ -302,15 +302,15 @@ alter table tenk2 set (parallel_workers = 0);
|
|||||||
explain (costs off)
|
explain (costs off)
|
||||||
select count(*) from tenk1 where (two, four) not in
|
select count(*) from tenk1 where (two, four) not in
|
||||||
(select hundred, thousand from tenk2 where thousand > 100);
|
(select hundred, thousand from tenk2 where thousand > 100);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------
|
||||||
Finalize Aggregate
|
Finalize Aggregate
|
||||||
-> Gather
|
-> Gather
|
||||||
Workers Planned: 4
|
Workers Planned: 4
|
||||||
-> Partial Aggregate
|
-> Partial Aggregate
|
||||||
-> Parallel Seq Scan on tenk1
|
-> Parallel Seq Scan on tenk1
|
||||||
Filter: (NOT (ANY ((two = (hashed SubPlan 1).col1) AND (four = (hashed SubPlan 1).col2))))
|
Filter: (NOT (ANY ((two = (hashed SubPlan any_1).col1) AND (four = (hashed SubPlan any_1).col2))))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on tenk2
|
-> Seq Scan on tenk2
|
||||||
Filter: (thousand > 100)
|
Filter: (thousand > 100)
|
||||||
(9 rows)
|
(9 rows)
|
||||||
@@ -326,11 +326,11 @@ select count(*) from tenk1 where (two, four) not in
|
|||||||
explain (costs off)
|
explain (costs off)
|
||||||
select * from tenk1 where (unique1 + random())::integer not in
|
select * from tenk1 where (unique1 + random())::integer not in
|
||||||
(select ten from tenk2);
|
(select ten from tenk2);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------
|
||||||
Seq Scan on tenk1
|
Seq Scan on tenk1
|
||||||
Filter: (NOT (ANY ((((unique1)::double precision + random()))::integer = (hashed SubPlan 1).col1)))
|
Filter: (NOT (ANY ((((unique1)::double precision + random()))::integer = (hashed SubPlan any_1).col1)))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on tenk2
|
-> Seq Scan on tenk2
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
@@ -343,10 +343,10 @@ alter table tenk2 set (parallel_workers = 2);
|
|||||||
explain (costs off)
|
explain (costs off)
|
||||||
select count(*) from tenk1
|
select count(*) from tenk1
|
||||||
where tenk1.unique1 = (Select max(tenk2.unique1) from tenk2);
|
where tenk1.unique1 = (Select max(tenk2.unique1) from tenk2);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
------------------------------------------------------
|
----------------------------------------------------------
|
||||||
Aggregate
|
Aggregate
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Finalize Aggregate
|
-> Finalize Aggregate
|
||||||
-> Gather
|
-> Gather
|
||||||
Workers Planned: 2
|
Workers Planned: 2
|
||||||
@@ -355,7 +355,7 @@ explain (costs off)
|
|||||||
-> Gather
|
-> Gather
|
||||||
Workers Planned: 4
|
Workers Planned: 4
|
||||||
-> Parallel Seq Scan on tenk1
|
-> Parallel Seq Scan on tenk1
|
||||||
Filter: (unique1 = (InitPlan 1).col1)
|
Filter: (unique1 = (InitPlan expr_1).col1)
|
||||||
(11 rows)
|
(11 rows)
|
||||||
|
|
||||||
select count(*) from tenk1
|
select count(*) from tenk1
|
||||||
@@ -395,17 +395,17 @@ select count((unique1)) from tenk1 where hundred > 1;
|
|||||||
explain (costs off)
|
explain (costs off)
|
||||||
select count((unique1)) from tenk1
|
select count((unique1)) from tenk1
|
||||||
where hundred = any ((select array_agg(i) from generate_series(1, 100, 15) i)::int[]);
|
where hundred = any ((select array_agg(i) from generate_series(1, 100, 15) i)::int[]);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
Finalize Aggregate
|
Finalize Aggregate
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
-> Function Scan on generate_series i
|
-> Function Scan on generate_series i
|
||||||
-> Gather
|
-> Gather
|
||||||
Workers Planned: 4
|
Workers Planned: 4
|
||||||
-> Partial Aggregate
|
-> Partial Aggregate
|
||||||
-> Parallel Index Scan using tenk1_hundred on tenk1
|
-> Parallel Index Scan using tenk1_hundred on tenk1
|
||||||
Index Cond: (hundred = ANY ((InitPlan 1).col1))
|
Index Cond: (hundred = ANY ((InitPlan expr_1).col1))
|
||||||
(9 rows)
|
(9 rows)
|
||||||
|
|
||||||
select count((unique1)) from tenk1
|
select count((unique1)) from tenk1
|
||||||
@@ -1224,24 +1224,24 @@ ORDER BY 1;
|
|||||||
-> Append
|
-> Append
|
||||||
-> Gather
|
-> Gather
|
||||||
Workers Planned: 4
|
Workers Planned: 4
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Gather
|
-> Gather
|
||||||
Workers Planned: 4
|
Workers Planned: 4
|
||||||
-> Parallel Seq Scan on tenk1 tenk1_2
|
-> Parallel Seq Scan on tenk1 tenk1_2
|
||||||
Filter: (fivethous = 1)
|
Filter: (fivethous = 1)
|
||||||
-> Parallel Seq Scan on tenk1
|
-> Parallel Seq Scan on tenk1
|
||||||
Filter: (fivethous = (InitPlan 1).col1)
|
Filter: (fivethous = (InitPlan expr_1).col1)
|
||||||
-> Gather
|
-> Gather
|
||||||
Workers Planned: 4
|
Workers Planned: 4
|
||||||
InitPlan 2
|
InitPlan expr_2
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Gather
|
-> Gather
|
||||||
Workers Planned: 4
|
Workers Planned: 4
|
||||||
-> Parallel Seq Scan on tenk1 tenk1_3
|
-> Parallel Seq Scan on tenk1 tenk1_3
|
||||||
Filter: (fivethous = 1)
|
Filter: (fivethous = 1)
|
||||||
-> Parallel Seq Scan on tenk1 tenk1_1
|
-> Parallel Seq Scan on tenk1 tenk1_1
|
||||||
Filter: (fivethous = (InitPlan 2).col1)
|
Filter: (fivethous = (InitPlan expr_2).col1)
|
||||||
(23 rows)
|
(23 rows)
|
||||||
|
|
||||||
-- test interaction with SRFs
|
-- test interaction with SRFs
|
||||||
@@ -1254,10 +1254,10 @@ ORDER BY 1, 2, 3;
|
|||||||
EXPLAIN (VERBOSE, COSTS OFF)
|
EXPLAIN (VERBOSE, COSTS OFF)
|
||||||
SELECT generate_series(1, two), array(select generate_series(1, two))
|
SELECT generate_series(1, two), array(select generate_series(1, two))
|
||||||
FROM tenk1 ORDER BY tenthous;
|
FROM tenk1 ORDER BY tenthous;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------------
|
||||||
ProjectSet
|
ProjectSet
|
||||||
Output: generate_series(1, tenk1.two), ARRAY(SubPlan 1), tenk1.tenthous
|
Output: generate_series(1, tenk1.two), ARRAY(SubPlan array_1), tenk1.tenthous
|
||||||
-> Gather Merge
|
-> Gather Merge
|
||||||
Output: tenk1.two, tenk1.tenthous
|
Output: tenk1.two, tenk1.tenthous
|
||||||
Workers Planned: 4
|
Workers Planned: 4
|
||||||
@@ -1268,7 +1268,7 @@ SELECT generate_series(1, two), array(select generate_series(1, two))
|
|||||||
Sort Key: tenk1.tenthous
|
Sort Key: tenk1.tenthous
|
||||||
-> Parallel Seq Scan on public.tenk1
|
-> Parallel Seq Scan on public.tenk1
|
||||||
Output: tenk1.tenthous, tenk1.two
|
Output: tenk1.tenthous, tenk1.two
|
||||||
SubPlan 1
|
SubPlan array_1
|
||||||
-> ProjectSet
|
-> ProjectSet
|
||||||
Output: generate_series(1, tenk1.two)
|
Output: generate_series(1, tenk1.two)
|
||||||
-> Result
|
-> Result
|
||||||
@@ -1333,11 +1333,11 @@ SELECT 1 FROM tenk1_vw_sec
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Subquery Scan on tenk1_vw_sec
|
Subquery Scan on tenk1_vw_sec
|
||||||
Filter: ((SubPlan 1) < 100)
|
Filter: ((SubPlan expr_1) < 100)
|
||||||
-> Gather
|
-> Gather
|
||||||
Workers Planned: 4
|
Workers Planned: 4
|
||||||
-> Parallel Index Only Scan using tenk1_unique1 on tenk1
|
-> Parallel Index Only Scan using tenk1_unique1 on tenk1
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
-> Seq Scan on int4_tbl
|
-> Seq Scan on int4_tbl
|
||||||
Filter: (f1 < tenk1_vw_sec.unique1)
|
Filter: (f1 < tenk1_vw_sec.unique1)
|
||||||
|
@@ -1093,8 +1093,8 @@ SELECT JSON_ARRAY(SELECT i FROM (VALUES (1), (2), (NULL), (4)) foo(i) RETURNING
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Output: (InitPlan 1).col1
|
Output: (InitPlan expr_1).col1
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Output: JSON_ARRAYAGG("*VALUES*".column1 RETURNING jsonb)
|
Output: JSON_ARRAYAGG("*VALUES*".column1 RETURNING jsonb)
|
||||||
-> Values Scan on "*VALUES*"
|
-> Values Scan on "*VALUES*"
|
||||||
|
@@ -205,11 +205,11 @@ SELECT f1 AS "Correlated Field"
|
|||||||
-- Check ROWCOMPARE cases, both correlated and not
|
-- Check ROWCOMPARE cases, both correlated and not
|
||||||
EXPLAIN (VERBOSE, COSTS OFF)
|
EXPLAIN (VERBOSE, COSTS OFF)
|
||||||
SELECT ROW(1, 2) = (SELECT f1, f2) AS eq FROM SUBSELECT_TBL;
|
SELECT ROW(1, 2) = (SELECT f1, f2) AS eq FROM SUBSELECT_TBL;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------------
|
---------------------------------------------------------------------------------------
|
||||||
Seq Scan on public.subselect_tbl
|
Seq Scan on public.subselect_tbl
|
||||||
Output: (((1 = (SubPlan 1).col1) AND (2 = (SubPlan 1).col2)))
|
Output: (((1 = (SubPlan rowcompare_1).col1) AND (2 = (SubPlan rowcompare_1).col2)))
|
||||||
SubPlan 1
|
SubPlan rowcompare_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: subselect_tbl.f1, subselect_tbl.f2
|
Output: subselect_tbl.f1, subselect_tbl.f2
|
||||||
(5 rows)
|
(5 rows)
|
||||||
@@ -229,11 +229,11 @@ SELECT ROW(1, 2) = (SELECT f1, f2) AS eq FROM SUBSELECT_TBL;
|
|||||||
|
|
||||||
EXPLAIN (VERBOSE, COSTS OFF)
|
EXPLAIN (VERBOSE, COSTS OFF)
|
||||||
SELECT ROW(1, 2) = (SELECT 3, 4) AS eq FROM SUBSELECT_TBL;
|
SELECT ROW(1, 2) = (SELECT 3, 4) AS eq FROM SUBSELECT_TBL;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------------
|
---------------------------------------------------------------------------------------
|
||||||
Seq Scan on public.subselect_tbl
|
Seq Scan on public.subselect_tbl
|
||||||
Output: ((1 = (InitPlan 1).col1) AND (2 = (InitPlan 1).col2))
|
Output: ((1 = (InitPlan rowcompare_1).col1) AND (2 = (InitPlan rowcompare_1).col2))
|
||||||
InitPlan 1
|
InitPlan rowcompare_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: 3, 4
|
Output: 3, 4
|
||||||
(5 rows)
|
(5 rows)
|
||||||
@@ -375,18 +375,18 @@ explain (verbose, costs off) select '42' union all select 43;
|
|||||||
-- check materialization of an initplan reference (bug #14524)
|
-- check materialization of an initplan reference (bug #14524)
|
||||||
explain (verbose, costs off)
|
explain (verbose, costs off)
|
||||||
select 1 = all (select (select 1));
|
select 1 = all (select (select 1));
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-------------------------------------------
|
------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Output: (ALL (1 = (SubPlan 2).col1))
|
Output: (ALL (1 = (SubPlan all_1).col1))
|
||||||
SubPlan 2
|
SubPlan all_1
|
||||||
-> Materialize
|
-> Materialize
|
||||||
Output: ((InitPlan 1).col1)
|
Output: ((InitPlan expr_1).col1)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: 1
|
Output: 1
|
||||||
-> Result
|
-> Result
|
||||||
Output: (InitPlan 1).col1
|
Output: (InitPlan expr_1).col1
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
select 1 = all (select (select 1));
|
select 1 = all (select (select 1));
|
||||||
@@ -428,8 +428,8 @@ select * from int4_tbl o where exists
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
Seq Scan on int4_tbl o
|
Seq Scan on int4_tbl o
|
||||||
Filter: EXISTS(SubPlan 1)
|
Filter: EXISTS(SubPlan exists_1)
|
||||||
SubPlan 1
|
SubPlan exists_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Seq Scan on int4_tbl i
|
-> Seq Scan on int4_tbl i
|
||||||
Filter: (f1 = o.f1)
|
Filter: (f1 = o.f1)
|
||||||
@@ -988,7 +988,7 @@ select (1 = any(array_agg(f1))) = any (select false) from int4_tbl;
|
|||||||
----------------------------
|
----------------------------
|
||||||
Aggregate
|
Aggregate
|
||||||
-> Seq Scan on int4_tbl
|
-> Seq Scan on int4_tbl
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Result
|
-> Result
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
@@ -1116,11 +1116,11 @@ select * from outer_text where (f1, f2) not in (select * from inner_text);
|
|||||||
--
|
--
|
||||||
explain (verbose, costs off)
|
explain (verbose, costs off)
|
||||||
select 'foo'::text in (select 'bar'::name union all select 'bar'::name);
|
select 'foo'::text in (select 'bar'::name union all select 'bar'::name);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Output: (ANY ('foo'::text = (hashed SubPlan 1).col1))
|
Output: (ANY ('foo'::text = (hashed SubPlan any_1).col1))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Append
|
-> Append
|
||||||
-> Result
|
-> Result
|
||||||
Output: 'bar'::name
|
Output: 'bar'::name
|
||||||
@@ -1140,11 +1140,11 @@ select 'foo'::text in (select 'bar'::name union all select 'bar'::name);
|
|||||||
--
|
--
|
||||||
explain (verbose, costs off)
|
explain (verbose, costs off)
|
||||||
select row(row(row(1))) = any (select row(row(1)));
|
select row(row(row(1))) = any (select row(row(1)));
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------
|
------------------------------------------------------------
|
||||||
Result
|
Result
|
||||||
Output: (ANY ('("(1)")'::record = (SubPlan 1).col1))
|
Output: (ANY ('("(1)")'::record = (SubPlan any_1).col1))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Materialize
|
-> Materialize
|
||||||
Output: '("(1)")'::record
|
Output: '("(1)")'::record
|
||||||
-> Result
|
-> Result
|
||||||
@@ -1184,11 +1184,11 @@ language sql as 'select $1::text = $2';
|
|||||||
create operator = (procedure=bogus_int8_text_eq, leftarg=int8, rightarg=text);
|
create operator = (procedure=bogus_int8_text_eq, leftarg=int8, rightarg=text);
|
||||||
explain (costs off)
|
explain (costs off)
|
||||||
select * from int8_tbl where q1 in (select c1 from inner_text);
|
select * from int8_tbl where q1 in (select c1 from inner_text);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------
|
------------------------------------------------------------
|
||||||
Seq Scan on int8_tbl
|
Seq Scan on int8_tbl
|
||||||
Filter: (ANY ((q1)::text = (hashed SubPlan 1).col1))
|
Filter: (ANY ((q1)::text = (hashed SubPlan any_1).col1))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on inner_text
|
-> Seq Scan on inner_text
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
@@ -1205,11 +1205,11 @@ create or replace function bogus_int8_text_eq(int8, text) returns boolean
|
|||||||
language sql as 'select $1::text = $2 and $1::text = $2';
|
language sql as 'select $1::text = $2 and $1::text = $2';
|
||||||
explain (costs off)
|
explain (costs off)
|
||||||
select * from int8_tbl where q1 in (select c1 from inner_text);
|
select * from int8_tbl where q1 in (select c1 from inner_text);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
Seq Scan on int8_tbl
|
Seq Scan on int8_tbl
|
||||||
Filter: (ANY (((q1)::text = (hashed SubPlan 1).col1) AND ((q1)::text = (hashed SubPlan 1).col1)))
|
Filter: (ANY (((q1)::text = (hashed SubPlan any_1).col1) AND ((q1)::text = (hashed SubPlan any_1).col1)))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on inner_text
|
-> Seq Scan on inner_text
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
@@ -1226,11 +1226,11 @@ create or replace function bogus_int8_text_eq(int8, text) returns boolean
|
|||||||
language sql as 'select $2 = $1::text';
|
language sql as 'select $2 = $1::text';
|
||||||
explain (costs off)
|
explain (costs off)
|
||||||
select * from int8_tbl where q1 in (select c1 from inner_text);
|
select * from int8_tbl where q1 in (select c1 from inner_text);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-------------------------------------------------
|
-----------------------------------------------------
|
||||||
Seq Scan on int8_tbl
|
Seq Scan on int8_tbl
|
||||||
Filter: (ANY ((SubPlan 1).col1 = (q1)::text))
|
Filter: (ANY ((SubPlan any_1).col1 = (q1)::text))
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Materialize
|
-> Materialize
|
||||||
-> Seq Scan on inner_text
|
-> Seq Scan on inner_text
|
||||||
(5 rows)
|
(5 rows)
|
||||||
@@ -1249,12 +1249,12 @@ rollback; -- to get rid of the bogus operator
|
|||||||
explain (costs off)
|
explain (costs off)
|
||||||
select count(*) from tenk1 t
|
select count(*) from tenk1 t
|
||||||
where (exists(select 1 from tenk1 k where k.unique1 = t.unique2) or ten < 0);
|
where (exists(select 1 from tenk1 k where k.unique1 = t.unique2) or ten < 0);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------------------
|
---------------------------------------------------------------------------------
|
||||||
Aggregate
|
Aggregate
|
||||||
-> Seq Scan on tenk1 t
|
-> Seq Scan on tenk1 t
|
||||||
Filter: ((ANY (unique2 = (hashed SubPlan 2).col1)) OR (ten < 0))
|
Filter: ((ANY (unique2 = (hashed SubPlan exists_2).col1)) OR (ten < 0))
|
||||||
SubPlan 2
|
SubPlan exists_2
|
||||||
-> Index Only Scan using tenk1_unique1 on tenk1 k
|
-> Index Only Scan using tenk1_unique1 on tenk1 k
|
||||||
(5 rows)
|
(5 rows)
|
||||||
|
|
||||||
@@ -1274,10 +1274,10 @@ where (exists(select 1 from tenk1 k where k.unique1 = t.unique2) or ten < 0)
|
|||||||
Aggregate
|
Aggregate
|
||||||
-> Bitmap Heap Scan on tenk1 t
|
-> Bitmap Heap Scan on tenk1 t
|
||||||
Recheck Cond: (thousand = 1)
|
Recheck Cond: (thousand = 1)
|
||||||
Filter: (EXISTS(SubPlan 1) OR (ten < 0))
|
Filter: (EXISTS(SubPlan exists_1) OR (ten < 0))
|
||||||
-> Bitmap Index Scan on tenk1_thous_tenthous
|
-> Bitmap Index Scan on tenk1_thous_tenthous
|
||||||
Index Cond: (thousand = 1)
|
Index Cond: (thousand = 1)
|
||||||
SubPlan 1
|
SubPlan exists_1
|
||||||
-> Index Only Scan using tenk1_unique1 on tenk1 k
|
-> Index Only Scan using tenk1_unique1 on tenk1 k
|
||||||
Index Cond: (unique1 = t.unique2)
|
Index Cond: (unique1 = t.unique2)
|
||||||
(9 rows)
|
(9 rows)
|
||||||
@@ -1299,20 +1299,20 @@ analyze exists_tbl;
|
|||||||
explain (costs off)
|
explain (costs off)
|
||||||
select * from exists_tbl t1
|
select * from exists_tbl t1
|
||||||
where (exists(select 1 from exists_tbl t2 where t1.c1 = t2.c2) or c3 < 0);
|
where (exists(select 1 from exists_tbl t2 where t1.c1 = t2.c2) or c3 < 0);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
Append
|
Append
|
||||||
-> Seq Scan on exists_tbl_null t1_1
|
-> Seq Scan on exists_tbl_null t1_1
|
||||||
Filter: (EXISTS(SubPlan 1) OR (c3 < 0))
|
Filter: (EXISTS(SubPlan exists_1) OR (c3 < 0))
|
||||||
SubPlan 1
|
SubPlan exists_1
|
||||||
-> Append
|
-> Append
|
||||||
-> Seq Scan on exists_tbl_null t2_1
|
-> Seq Scan on exists_tbl_null t2_1
|
||||||
Filter: (t1_1.c1 = c2)
|
Filter: (t1_1.c1 = c2)
|
||||||
-> Seq Scan on exists_tbl_def t2_2
|
-> Seq Scan on exists_tbl_def t2_2
|
||||||
Filter: (t1_1.c1 = c2)
|
Filter: (t1_1.c1 = c2)
|
||||||
-> Seq Scan on exists_tbl_def t1_2
|
-> Seq Scan on exists_tbl_def t1_2
|
||||||
Filter: ((ANY (c1 = (hashed SubPlan 2).col1)) OR (c3 < 0))
|
Filter: ((ANY (c1 = (hashed SubPlan exists_2).col1)) OR (c3 < 0))
|
||||||
SubPlan 2
|
SubPlan exists_2
|
||||||
-> Append
|
-> Append
|
||||||
-> Seq Scan on exists_tbl_null t2_4
|
-> Seq Scan on exists_tbl_null t2_4
|
||||||
-> Seq Scan on exists_tbl_def t2_5
|
-> Seq Scan on exists_tbl_def t2_5
|
||||||
@@ -1348,14 +1348,14 @@ where a.thousand = b.thousand
|
|||||||
explain (verbose, costs off)
|
explain (verbose, costs off)
|
||||||
select x, x from
|
select x, x from
|
||||||
(select (select now()) as x from (values(1),(2)) v(y)) ss;
|
(select (select now()) as x from (values(1),(2)) v(y)) ss;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
------------------------------------------------
|
----------------------------------------------------------
|
||||||
Values Scan on "*VALUES*"
|
Values Scan on "*VALUES*"
|
||||||
Output: (InitPlan 1).col1, (InitPlan 2).col1
|
Output: (InitPlan expr_1).col1, (InitPlan expr_2).col1
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: now()
|
Output: now()
|
||||||
InitPlan 2
|
InitPlan expr_2
|
||||||
-> Result
|
-> Result
|
||||||
Output: now()
|
Output: now()
|
||||||
(8 rows)
|
(8 rows)
|
||||||
@@ -1363,13 +1363,13 @@ explain (verbose, costs off)
|
|||||||
explain (verbose, costs off)
|
explain (verbose, costs off)
|
||||||
select x, x from
|
select x, x from
|
||||||
(select (select random()) as x from (values(1),(2)) v(y)) ss;
|
(select (select random()) as x from (values(1),(2)) v(y)) ss;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------
|
----------------------------------------
|
||||||
Subquery Scan on ss
|
Subquery Scan on ss
|
||||||
Output: ss.x, ss.x
|
Output: ss.x, ss.x
|
||||||
-> Values Scan on "*VALUES*"
|
-> Values Scan on "*VALUES*"
|
||||||
Output: (InitPlan 1).col1
|
Output: (InitPlan expr_1).col1
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: random()
|
Output: random()
|
||||||
(7 rows)
|
(7 rows)
|
||||||
@@ -1380,12 +1380,12 @@ explain (verbose, costs off)
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
Values Scan on "*VALUES*"
|
Values Scan on "*VALUES*"
|
||||||
Output: (SubPlan 1), (SubPlan 2)
|
Output: (SubPlan expr_1), (SubPlan expr_2)
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: now()
|
Output: now()
|
||||||
One-Time Filter: ("*VALUES*".column1 = "*VALUES*".column1)
|
One-Time Filter: ("*VALUES*".column1 = "*VALUES*".column1)
|
||||||
SubPlan 2
|
SubPlan expr_2
|
||||||
-> Result
|
-> Result
|
||||||
Output: now()
|
Output: now()
|
||||||
One-Time Filter: ("*VALUES*".column1 = "*VALUES*".column1)
|
One-Time Filter: ("*VALUES*".column1 = "*VALUES*".column1)
|
||||||
@@ -1399,8 +1399,8 @@ explain (verbose, costs off)
|
|||||||
Subquery Scan on ss
|
Subquery Scan on ss
|
||||||
Output: ss.x, ss.x
|
Output: ss.x, ss.x
|
||||||
-> Values Scan on "*VALUES*"
|
-> Values Scan on "*VALUES*"
|
||||||
Output: (SubPlan 1)
|
Output: (SubPlan expr_1)
|
||||||
SubPlan 1
|
SubPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
Output: random()
|
Output: random()
|
||||||
One-Time Filter: ("*VALUES*".column1 = "*VALUES*".column1)
|
One-Time Filter: ("*VALUES*".column1 = "*VALUES*".column1)
|
||||||
@@ -1420,16 +1420,16 @@ where o.ten = 0;
|
|||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
Aggregate
|
Aggregate
|
||||||
Output: sum((((ANY (i.ten = (hashed SubPlan 1).col1))))::integer)
|
Output: sum((((ANY (i.ten = (hashed SubPlan any_1).col1))))::integer)
|
||||||
-> Nested Loop
|
-> Nested Loop
|
||||||
Output: ((ANY (i.ten = (hashed SubPlan 1).col1)))
|
Output: ((ANY (i.ten = (hashed SubPlan any_1).col1)))
|
||||||
-> Seq Scan on public.onek o
|
-> Seq Scan on public.onek o
|
||||||
Output: o.unique1, o.unique2, o.two, o.four, o.ten, o.twenty, o.hundred, o.thousand, o.twothousand, o.fivethous, o.tenthous, o.odd, o.even, o.stringu1, o.stringu2, o.string4
|
Output: o.unique1, o.unique2, o.two, o.four, o.ten, o.twenty, o.hundred, o.thousand, o.twothousand, o.fivethous, o.tenthous, o.odd, o.even, o.stringu1, o.stringu2, o.string4
|
||||||
Filter: (o.ten = 0)
|
Filter: (o.ten = 0)
|
||||||
-> Index Scan using onek_unique1 on public.onek i
|
-> Index Scan using onek_unique1 on public.onek i
|
||||||
Output: (ANY (i.ten = (hashed SubPlan 1).col1)), random()
|
Output: (ANY (i.ten = (hashed SubPlan any_1).col1)), random()
|
||||||
Index Cond: (i.unique1 = o.unique1)
|
Index Cond: (i.unique1 = o.unique1)
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on public.int4_tbl
|
-> Seq Scan on public.int4_tbl
|
||||||
Output: int4_tbl.f1
|
Output: int4_tbl.f1
|
||||||
Filter: (int4_tbl.f1 <= o.hundred)
|
Filter: (int4_tbl.f1 <= o.hundred)
|
||||||
@@ -1638,7 +1638,7 @@ select * from
|
|||||||
----------------------------------------
|
----------------------------------------
|
||||||
Values Scan on "*VALUES*"
|
Values Scan on "*VALUES*"
|
||||||
Output: "*VALUES*".column1
|
Output: "*VALUES*".column1
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Values Scan on "*VALUES*_1"
|
-> Values Scan on "*VALUES*_1"
|
||||||
Output: "*VALUES*_1".column1
|
Output: "*VALUES*_1".column1
|
||||||
(5 rows)
|
(5 rows)
|
||||||
@@ -1665,12 +1665,12 @@ select * from int4_tbl where
|
|||||||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
Nested Loop Semi Join
|
Nested Loop Semi Join
|
||||||
Output: int4_tbl.f1
|
Output: int4_tbl.f1
|
||||||
Join Filter: (CASE WHEN (ANY (int4_tbl.f1 = (hashed SubPlan 1).col1)) THEN int4_tbl.f1 ELSE NULL::integer END = b.ten)
|
Join Filter: (CASE WHEN (ANY (int4_tbl.f1 = (hashed SubPlan any_1).col1)) THEN int4_tbl.f1 ELSE NULL::integer END = b.ten)
|
||||||
-> Seq Scan on public.int4_tbl
|
-> Seq Scan on public.int4_tbl
|
||||||
Output: int4_tbl.f1
|
Output: int4_tbl.f1
|
||||||
-> Seq Scan on public.tenk1 b
|
-> Seq Scan on public.tenk1 b
|
||||||
Output: b.unique1, b.unique2, b.two, b.four, b.ten, b.twenty, b.hundred, b.thousand, b.twothousand, b.fivethous, b.tenthous, b.odd, b.even, b.stringu1, b.stringu2, b.string4
|
Output: b.unique1, b.unique2, b.two, b.four, b.ten, b.twenty, b.hundred, b.thousand, b.twothousand, b.fivethous, b.tenthous, b.odd, b.even, b.stringu1, b.stringu2, b.string4
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Index Only Scan using tenk1_unique1 on public.tenk1 a
|
-> Index Only Scan using tenk1_unique1 on public.tenk1 a
|
||||||
Output: a.unique1
|
Output: a.unique1
|
||||||
(10 rows)
|
(10 rows)
|
||||||
@@ -2798,14 +2798,14 @@ select * from tenk1 A where exists
|
|||||||
(select 1 from tenk2 B
|
(select 1 from tenk2 B
|
||||||
where A.hundred in (select C.hundred FROM tenk2 C
|
where A.hundred in (select C.hundred FROM tenk2 C
|
||||||
WHERE c.odd = b.odd));
|
WHERE c.odd = b.odd));
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------
|
---------------------------------------------------------
|
||||||
Nested Loop Semi Join
|
Nested Loop Semi Join
|
||||||
Join Filter: (ANY (a.hundred = (SubPlan 1).col1))
|
Join Filter: (ANY (a.hundred = (SubPlan any_1).col1))
|
||||||
-> Seq Scan on tenk1 a
|
-> Seq Scan on tenk1 a
|
||||||
-> Materialize
|
-> Materialize
|
||||||
-> Seq Scan on tenk2 b
|
-> Seq Scan on tenk2 b
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on tenk2 c
|
-> Seq Scan on tenk2 c
|
||||||
Filter: (odd = b.odd)
|
Filter: (odd = b.odd)
|
||||||
(8 rows)
|
(8 rows)
|
||||||
@@ -2815,14 +2815,14 @@ WHERE c.odd = b.odd));
|
|||||||
explain (costs off)
|
explain (costs off)
|
||||||
SELECT * FROM tenk1 A LEFT JOIN tenk2 B
|
SELECT * FROM tenk1 A LEFT JOIN tenk2 B
|
||||||
ON A.hundred in (SELECT c.hundred FROM tenk2 C WHERE c.odd = b.odd);
|
ON A.hundred in (SELECT c.hundred FROM tenk2 C WHERE c.odd = b.odd);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------
|
---------------------------------------------------------
|
||||||
Nested Loop Left Join
|
Nested Loop Left Join
|
||||||
Join Filter: (ANY (a.hundred = (SubPlan 1).col1))
|
Join Filter: (ANY (a.hundred = (SubPlan any_1).col1))
|
||||||
-> Seq Scan on tenk1 a
|
-> Seq Scan on tenk1 a
|
||||||
-> Materialize
|
-> Materialize
|
||||||
-> Seq Scan on tenk2 b
|
-> Seq Scan on tenk2 b
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on tenk2 c
|
-> Seq Scan on tenk2 c
|
||||||
Filter: (odd = b.odd)
|
Filter: (odd = b.odd)
|
||||||
(8 rows)
|
(8 rows)
|
||||||
@@ -2832,14 +2832,14 @@ ON A.hundred in (SELECT c.hundred FROM tenk2 C WHERE c.odd = b.odd);
|
|||||||
explain (costs off)
|
explain (costs off)
|
||||||
SELECT * FROM tenk1 A LEFT JOIN tenk2 B
|
SELECT * FROM tenk1 A LEFT JOIN tenk2 B
|
||||||
ON B.hundred in (SELECT c.hundred FROM tenk2 C WHERE c.odd = a.odd);
|
ON B.hundred in (SELECT c.hundred FROM tenk2 C WHERE c.odd = a.odd);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------
|
---------------------------------------------------------
|
||||||
Nested Loop Left Join
|
Nested Loop Left Join
|
||||||
Join Filter: (ANY (b.hundred = (SubPlan 1).col1))
|
Join Filter: (ANY (b.hundred = (SubPlan any_1).col1))
|
||||||
-> Seq Scan on tenk1 a
|
-> Seq Scan on tenk1 a
|
||||||
-> Materialize
|
-> Materialize
|
||||||
-> Seq Scan on tenk2 b
|
-> Seq Scan on tenk2 b
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Seq Scan on tenk2 c
|
-> Seq Scan on tenk2 c
|
||||||
Filter: (odd = a.odd)
|
Filter: (odd = a.odd)
|
||||||
(8 rows)
|
(8 rows)
|
||||||
@@ -2901,7 +2901,7 @@ ON B.hundred in (SELECT min(c.hundred) FROM tenk2 C WHERE c.odd = b.odd);
|
|||||||
Filter: (b.hundred = unnamed_subquery.min)
|
Filter: (b.hundred = unnamed_subquery.min)
|
||||||
-> Result
|
-> Result
|
||||||
Replaces: MinMaxAggregate
|
Replaces: MinMaxAggregate
|
||||||
InitPlan 1
|
InitPlan minmax_1
|
||||||
-> Limit
|
-> Limit
|
||||||
-> Index Scan using tenk2_hundred on tenk2 c
|
-> Index Scan using tenk2_hundred on tenk2 c
|
||||||
Index Cond: (hundred IS NOT NULL)
|
Index Cond: (hundred IS NOT NULL)
|
||||||
@@ -3142,7 +3142,7 @@ WHERE unique1 IN (VALUES (0), ((2 IN (SELECT unique2 FROM onek c
|
|||||||
-> Seq Scan on onek t
|
-> Seq Scan on onek t
|
||||||
-> Values Scan on "*VALUES*"
|
-> Values Scan on "*VALUES*"
|
||||||
Filter: (t.unique1 = column1)
|
Filter: (t.unique1 = column1)
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Index Only Scan using onek_unique2 on onek c
|
-> Index Only Scan using onek_unique2 on onek c
|
||||||
Index Cond: (unique2 = t.unique1)
|
Index Cond: (unique2 = t.unique1)
|
||||||
(7 rows)
|
(7 rows)
|
||||||
@@ -3158,7 +3158,7 @@ WHERE unique1 IN (VALUES (0), ((2 IN (SELECT unique2 FROM onek c
|
|||||||
-> Sort
|
-> Sort
|
||||||
Sort Key: "*VALUES*".column1
|
Sort Key: "*VALUES*".column1
|
||||||
-> Values Scan on "*VALUES*"
|
-> Values Scan on "*VALUES*"
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Index Only Scan using onek_unique2 on onek c
|
-> Index Only Scan using onek_unique2 on onek c
|
||||||
Filter: ((unique2)::double precision = ANY ('{0.479425538604203,2}'::double precision[]))
|
Filter: ((unique2)::double precision = ANY ('{0.479425538604203,2}'::double precision[]))
|
||||||
-> Index Scan using onek_unique1 on onek t
|
-> Index Scan using onek_unique1 on onek t
|
||||||
@@ -3177,7 +3177,7 @@ SELECT ten FROM onek t WHERE unique1 IN (VALUES (0), ((2 IN
|
|||||||
-> Sort
|
-> Sort
|
||||||
Sort Key: "*VALUES*".column1
|
Sort Key: "*VALUES*".column1
|
||||||
-> Values Scan on "*VALUES*"
|
-> Values Scan on "*VALUES*"
|
||||||
SubPlan 1
|
SubPlan any_1
|
||||||
-> Result
|
-> Result
|
||||||
-> Index Scan using onek_unique1 on onek t
|
-> Index Scan using onek_unique1 on onek t
|
||||||
Index Cond: (unique1 = "*VALUES*".column1)
|
Index Cond: (unique1 = "*VALUES*".column1)
|
||||||
|
@@ -2750,7 +2750,7 @@ EXPLAIN (costs off) INSERT INTO rw_view1 VALUES (5);
|
|||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
Insert on base_tbl b
|
Insert on base_tbl b
|
||||||
-> Result
|
-> Result
|
||||||
SubPlan 1
|
SubPlan exists_1
|
||||||
-> Index Only Scan using ref_tbl_pkey on ref_tbl r
|
-> Index Only Scan using ref_tbl_pkey on ref_tbl r
|
||||||
Index Cond: (a = b.a)
|
Index Cond: (a = b.a)
|
||||||
(5 rows)
|
(5 rows)
|
||||||
@@ -2764,7 +2764,7 @@ EXPLAIN (costs off) UPDATE rw_view1 SET a = a + 5;
|
|||||||
-> Seq Scan on base_tbl b
|
-> Seq Scan on base_tbl b
|
||||||
-> Hash
|
-> Hash
|
||||||
-> Seq Scan on ref_tbl r
|
-> Seq Scan on ref_tbl r
|
||||||
SubPlan 1
|
SubPlan exists_1
|
||||||
-> Index Only Scan using ref_tbl_pkey on ref_tbl r_1
|
-> Index Only Scan using ref_tbl_pkey on ref_tbl r_1
|
||||||
Index Cond: (a = b.a)
|
Index Cond: (a = b.a)
|
||||||
(9 rows)
|
(9 rows)
|
||||||
@@ -3167,21 +3167,21 @@ EXPLAIN (costs off) DELETE FROM rw_view1 WHERE id = 1 AND snoop(data);
|
|||||||
DELETE FROM rw_view1 WHERE id = 1 AND snoop(data);
|
DELETE FROM rw_view1 WHERE id = 1 AND snoop(data);
|
||||||
NOTICE: snooped value: Row 1
|
NOTICE: snooped value: Row 1
|
||||||
EXPLAIN (costs off) INSERT INTO rw_view1 VALUES (2, 'New row 2');
|
EXPLAIN (costs off) INSERT INTO rw_view1 VALUES (2, 'New row 2');
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------------
|
||||||
Insert on base_tbl
|
Insert on base_tbl
|
||||||
InitPlan 1
|
InitPlan exists_1
|
||||||
-> Index Only Scan using base_tbl_pkey on base_tbl t
|
-> Index Only Scan using base_tbl_pkey on base_tbl t
|
||||||
Index Cond: (id = 2)
|
Index Cond: (id = 2)
|
||||||
-> Result
|
-> Result
|
||||||
One-Time Filter: ((InitPlan 1).col1 IS NOT TRUE)
|
One-Time Filter: ((InitPlan exists_1).col1 IS NOT TRUE)
|
||||||
|
|
||||||
Update on base_tbl
|
Update on base_tbl
|
||||||
InitPlan 1
|
InitPlan exists_1
|
||||||
-> Index Only Scan using base_tbl_pkey on base_tbl t
|
-> Index Only Scan using base_tbl_pkey on base_tbl t
|
||||||
Index Cond: (id = 2)
|
Index Cond: (id = 2)
|
||||||
-> Result
|
-> Result
|
||||||
One-Time Filter: (InitPlan 1).col1
|
One-Time Filter: (InitPlan exists_1).col1
|
||||||
-> Index Scan using base_tbl_pkey on base_tbl
|
-> Index Scan using base_tbl_pkey on base_tbl
|
||||||
Index Cond: (id = 2)
|
Index Cond: (id = 2)
|
||||||
(15 rows)
|
(15 rows)
|
||||||
@@ -3240,8 +3240,8 @@ SELECT * FROM v1 WHERE a=8;
|
|||||||
|
|
||||||
EXPLAIN (VERBOSE, COSTS OFF)
|
EXPLAIN (VERBOSE, COSTS OFF)
|
||||||
UPDATE v1 SET a=100 WHERE snoop(a) AND leakproof(a) AND a < 7 AND a != 6;
|
UPDATE v1 SET a=100 WHERE snoop(a) AND leakproof(a) AND a < 7 AND a != 6;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------
|
||||||
Update on public.t1
|
Update on public.t1
|
||||||
Update on public.t1 t1_1
|
Update on public.t1 t1_1
|
||||||
Update on public.t11 t1_2
|
Update on public.t11 t1_2
|
||||||
@@ -3253,8 +3253,8 @@ UPDATE v1 SET a=100 WHERE snoop(a) AND leakproof(a) AND a < 7 AND a != 6;
|
|||||||
-> Index Scan using t1_a_idx on public.t1 t1_1
|
-> Index Scan using t1_a_idx on public.t1 t1_1
|
||||||
Output: t1_1.tableoid, t1_1.ctid
|
Output: t1_1.tableoid, t1_1.ctid
|
||||||
Index Cond: ((t1_1.a > 5) AND (t1_1.a < 7))
|
Index Cond: ((t1_1.a > 5) AND (t1_1.a < 7))
|
||||||
Filter: ((t1_1.a <> 6) AND EXISTS(SubPlan 1) AND snoop(t1_1.a) AND leakproof(t1_1.a))
|
Filter: ((t1_1.a <> 6) AND EXISTS(SubPlan exists_1) AND snoop(t1_1.a) AND leakproof(t1_1.a))
|
||||||
SubPlan 1
|
SubPlan exists_1
|
||||||
-> Append
|
-> Append
|
||||||
-> Seq Scan on public.t12 t12_1
|
-> Seq Scan on public.t12 t12_1
|
||||||
Filter: (t12_1.a = t1_1.a)
|
Filter: (t12_1.a = t1_1.a)
|
||||||
@@ -3263,15 +3263,15 @@ UPDATE v1 SET a=100 WHERE snoop(a) AND leakproof(a) AND a < 7 AND a != 6;
|
|||||||
-> Index Scan using t11_a_idx on public.t11 t1_2
|
-> Index Scan using t11_a_idx on public.t11 t1_2
|
||||||
Output: t1_2.tableoid, t1_2.ctid
|
Output: t1_2.tableoid, t1_2.ctid
|
||||||
Index Cond: ((t1_2.a > 5) AND (t1_2.a < 7))
|
Index Cond: ((t1_2.a > 5) AND (t1_2.a < 7))
|
||||||
Filter: ((t1_2.a <> 6) AND EXISTS(SubPlan 1) AND snoop(t1_2.a) AND leakproof(t1_2.a))
|
Filter: ((t1_2.a <> 6) AND EXISTS(SubPlan exists_1) AND snoop(t1_2.a) AND leakproof(t1_2.a))
|
||||||
-> Index Scan using t12_a_idx on public.t12 t1_3
|
-> Index Scan using t12_a_idx on public.t12 t1_3
|
||||||
Output: t1_3.tableoid, t1_3.ctid
|
Output: t1_3.tableoid, t1_3.ctid
|
||||||
Index Cond: ((t1_3.a > 5) AND (t1_3.a < 7))
|
Index Cond: ((t1_3.a > 5) AND (t1_3.a < 7))
|
||||||
Filter: ((t1_3.a <> 6) AND EXISTS(SubPlan 1) AND snoop(t1_3.a) AND leakproof(t1_3.a))
|
Filter: ((t1_3.a <> 6) AND EXISTS(SubPlan exists_1) AND snoop(t1_3.a) AND leakproof(t1_3.a))
|
||||||
-> Index Scan using t111_a_idx on public.t111 t1_4
|
-> Index Scan using t111_a_idx on public.t111 t1_4
|
||||||
Output: t1_4.tableoid, t1_4.ctid
|
Output: t1_4.tableoid, t1_4.ctid
|
||||||
Index Cond: ((t1_4.a > 5) AND (t1_4.a < 7))
|
Index Cond: ((t1_4.a > 5) AND (t1_4.a < 7))
|
||||||
Filter: ((t1_4.a <> 6) AND EXISTS(SubPlan 1) AND snoop(t1_4.a) AND leakproof(t1_4.a))
|
Filter: ((t1_4.a <> 6) AND EXISTS(SubPlan exists_1) AND snoop(t1_4.a) AND leakproof(t1_4.a))
|
||||||
(30 rows)
|
(30 rows)
|
||||||
|
|
||||||
UPDATE v1 SET a=100 WHERE snoop(a) AND leakproof(a) AND a < 7 AND a != 6;
|
UPDATE v1 SET a=100 WHERE snoop(a) AND leakproof(a) AND a < 7 AND a != 6;
|
||||||
@@ -3287,8 +3287,8 @@ SELECT * FROM t1 WHERE a=100; -- Nothing should have been changed to 100
|
|||||||
|
|
||||||
EXPLAIN (VERBOSE, COSTS OFF)
|
EXPLAIN (VERBOSE, COSTS OFF)
|
||||||
UPDATE v1 SET a=a+1 WHERE snoop(a) AND leakproof(a) AND a = 8;
|
UPDATE v1 SET a=a+1 WHERE snoop(a) AND leakproof(a) AND a = 8;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
-----------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------
|
||||||
Update on public.t1
|
Update on public.t1
|
||||||
Update on public.t1 t1_1
|
Update on public.t1 t1_1
|
||||||
Update on public.t11 t1_2
|
Update on public.t11 t1_2
|
||||||
@@ -3300,8 +3300,8 @@ UPDATE v1 SET a=a+1 WHERE snoop(a) AND leakproof(a) AND a = 8;
|
|||||||
-> Index Scan using t1_a_idx on public.t1 t1_1
|
-> Index Scan using t1_a_idx on public.t1 t1_1
|
||||||
Output: t1_1.a, t1_1.tableoid, t1_1.ctid
|
Output: t1_1.a, t1_1.tableoid, t1_1.ctid
|
||||||
Index Cond: ((t1_1.a > 5) AND (t1_1.a = 8))
|
Index Cond: ((t1_1.a > 5) AND (t1_1.a = 8))
|
||||||
Filter: (EXISTS(SubPlan 1) AND snoop(t1_1.a) AND leakproof(t1_1.a))
|
Filter: (EXISTS(SubPlan exists_1) AND snoop(t1_1.a) AND leakproof(t1_1.a))
|
||||||
SubPlan 1
|
SubPlan exists_1
|
||||||
-> Append
|
-> Append
|
||||||
-> Seq Scan on public.t12 t12_1
|
-> Seq Scan on public.t12 t12_1
|
||||||
Filter: (t12_1.a = t1_1.a)
|
Filter: (t12_1.a = t1_1.a)
|
||||||
@@ -3310,15 +3310,15 @@ UPDATE v1 SET a=a+1 WHERE snoop(a) AND leakproof(a) AND a = 8;
|
|||||||
-> Index Scan using t11_a_idx on public.t11 t1_2
|
-> Index Scan using t11_a_idx on public.t11 t1_2
|
||||||
Output: t1_2.a, t1_2.tableoid, t1_2.ctid
|
Output: t1_2.a, t1_2.tableoid, t1_2.ctid
|
||||||
Index Cond: ((t1_2.a > 5) AND (t1_2.a = 8))
|
Index Cond: ((t1_2.a > 5) AND (t1_2.a = 8))
|
||||||
Filter: (EXISTS(SubPlan 1) AND snoop(t1_2.a) AND leakproof(t1_2.a))
|
Filter: (EXISTS(SubPlan exists_1) AND snoop(t1_2.a) AND leakproof(t1_2.a))
|
||||||
-> Index Scan using t12_a_idx on public.t12 t1_3
|
-> Index Scan using t12_a_idx on public.t12 t1_3
|
||||||
Output: t1_3.a, t1_3.tableoid, t1_3.ctid
|
Output: t1_3.a, t1_3.tableoid, t1_3.ctid
|
||||||
Index Cond: ((t1_3.a > 5) AND (t1_3.a = 8))
|
Index Cond: ((t1_3.a > 5) AND (t1_3.a = 8))
|
||||||
Filter: (EXISTS(SubPlan 1) AND snoop(t1_3.a) AND leakproof(t1_3.a))
|
Filter: (EXISTS(SubPlan exists_1) AND snoop(t1_3.a) AND leakproof(t1_3.a))
|
||||||
-> Index Scan using t111_a_idx on public.t111 t1_4
|
-> Index Scan using t111_a_idx on public.t111 t1_4
|
||||||
Output: t1_4.a, t1_4.tableoid, t1_4.ctid
|
Output: t1_4.a, t1_4.tableoid, t1_4.ctid
|
||||||
Index Cond: ((t1_4.a > 5) AND (t1_4.a = 8))
|
Index Cond: ((t1_4.a > 5) AND (t1_4.a = 8))
|
||||||
Filter: (EXISTS(SubPlan 1) AND snoop(t1_4.a) AND leakproof(t1_4.a))
|
Filter: (EXISTS(SubPlan exists_1) AND snoop(t1_4.a) AND leakproof(t1_4.a))
|
||||||
(30 rows)
|
(30 rows)
|
||||||
|
|
||||||
UPDATE v1 SET a=a+1 WHERE snoop(a) AND leakproof(a) AND a = 8;
|
UPDATE v1 SET a=a+1 WHERE snoop(a) AND leakproof(a) AND a = 8;
|
||||||
@@ -3502,10 +3502,10 @@ CREATE RULE v1_upd_rule AS ON UPDATE TO v1 DO INSTEAD
|
|||||||
CREATE VIEW v2 WITH (security_barrier = true) AS
|
CREATE VIEW v2 WITH (security_barrier = true) AS
|
||||||
SELECT * FROM v1 WHERE EXISTS (SELECT 1);
|
SELECT * FROM v1 WHERE EXISTS (SELECT 1);
|
||||||
EXPLAIN (COSTS OFF) UPDATE v2 SET a = 1;
|
EXPLAIN (COSTS OFF) UPDATE v2 SET a = 1;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Update on t1
|
Update on t1
|
||||||
InitPlan 1
|
InitPlan exists_1
|
||||||
-> Result
|
-> Result
|
||||||
-> Merge Join
|
-> Merge Join
|
||||||
Merge Cond: (t1.a = v1.a)
|
Merge Cond: (t1.a = v1.a)
|
||||||
@@ -3516,7 +3516,7 @@ EXPLAIN (COSTS OFF) UPDATE v2 SET a = 1;
|
|||||||
Sort Key: v1.a
|
Sort Key: v1.a
|
||||||
-> Subquery Scan on v1
|
-> Subquery Scan on v1
|
||||||
-> Result
|
-> Result
|
||||||
One-Time Filter: (InitPlan 1).col1
|
One-Time Filter: (InitPlan exists_1).col1
|
||||||
-> Seq Scan on t1 t1_1
|
-> Seq Scan on t1 t1_1
|
||||||
(14 rows)
|
(14 rows)
|
||||||
|
|
||||||
|
@@ -178,15 +178,15 @@ EXPLAIN (VERBOSE, COSTS OFF)
|
|||||||
UPDATE update_test t
|
UPDATE update_test t
|
||||||
SET (a, b) = (SELECT b, a FROM update_test s WHERE s.a = t.a)
|
SET (a, b) = (SELECT b, a FROM update_test s WHERE s.a = t.a)
|
||||||
WHERE CURRENT_USER = SESSION_USER;
|
WHERE CURRENT_USER = SESSION_USER;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------------------
|
||||||
Update on public.update_test t
|
Update on public.update_test t
|
||||||
-> Result
|
-> Result
|
||||||
Output: (SubPlan 1).col1, (SubPlan 1).col2, (rescan SubPlan 1), t.ctid
|
Output: (SubPlan multiexpr_1).col1, (SubPlan multiexpr_1).col2, (rescan SubPlan multiexpr_1), t.ctid
|
||||||
One-Time Filter: (CURRENT_USER = SESSION_USER)
|
One-Time Filter: (CURRENT_USER = SESSION_USER)
|
||||||
-> Seq Scan on public.update_test t
|
-> Seq Scan on public.update_test t
|
||||||
Output: t.a, t.ctid
|
Output: t.a, t.ctid
|
||||||
SubPlan 1
|
SubPlan multiexpr_1
|
||||||
-> Seq Scan on public.update_test s
|
-> Seq Scan on public.update_test s
|
||||||
Output: s.b, s.a
|
Output: s.b, s.a
|
||||||
Filter: (s.a = t.a)
|
Filter: (s.a = t.a)
|
||||||
|
@@ -4250,14 +4250,14 @@ SELECT 1 FROM
|
|||||||
(SELECT ntile(s1.x) OVER () AS c
|
(SELECT ntile(s1.x) OVER () AS c
|
||||||
FROM (SELECT (SELECT 1) AS x) AS s1) s
|
FROM (SELECT (SELECT 1) AS x) AS s1) s
|
||||||
WHERE s.c = 1;
|
WHERE s.c = 1;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
----------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Subquery Scan on s
|
Subquery Scan on s
|
||||||
Filter: (s.c = 1)
|
Filter: (s.c = 1)
|
||||||
-> WindowAgg
|
-> WindowAgg
|
||||||
Window: w1 AS (ROWS UNBOUNDED PRECEDING)
|
Window: w1 AS (ROWS UNBOUNDED PRECEDING)
|
||||||
Run Condition: (ntile((InitPlan 1).col1) OVER w1 <= 1)
|
Run Condition: (ntile((InitPlan expr_1).col1) OVER w1 <= 1)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
-> Result
|
-> Result
|
||||||
(8 rows)
|
(8 rows)
|
||||||
@@ -4338,7 +4338,7 @@ WHERE c = 1;
|
|||||||
Filter: (emp.c = 1)
|
Filter: (emp.c = 1)
|
||||||
-> WindowAgg
|
-> WindowAgg
|
||||||
Window: w1 AS (ORDER BY empsalary.empno)
|
Window: w1 AS (ORDER BY empsalary.empno)
|
||||||
InitPlan 1
|
InitPlan expr_1
|
||||||
-> Result
|
-> Result
|
||||||
-> Sort
|
-> Sort
|
||||||
Sort Key: empsalary.empno DESC
|
Sort Key: empsalary.empno DESC
|
||||||
|
@@ -2306,14 +2306,14 @@ explain (verbose, costs off)
|
|||||||
select f1, (with cte1(x,y) as (select 1,2)
|
select f1, (with cte1(x,y) as (select 1,2)
|
||||||
select count((select i4.f1 from cte1))) as ss
|
select count((select i4.f1 from cte1))) as ss
|
||||||
from int4_tbl i4;
|
from int4_tbl i4;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------
|
-------------------------------------------------
|
||||||
Seq Scan on public.int4_tbl i4
|
Seq Scan on public.int4_tbl i4
|
||||||
Output: i4.f1, (SubPlan 2)
|
Output: i4.f1, (SubPlan expr_1)
|
||||||
SubPlan 2
|
SubPlan expr_1
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
Output: count((InitPlan 1).col1)
|
Output: count((InitPlan expr_2).col1)
|
||||||
InitPlan 1
|
InitPlan expr_2
|
||||||
-> Result
|
-> Result
|
||||||
Output: i4.f1
|
Output: i4.f1
|
||||||
-> Result
|
-> Result
|
||||||
@@ -3203,7 +3203,7 @@ WHEN NOT MATCHED THEN INSERT VALUES(o.k, o.v);
|
|||||||
Output: o.k, o.v, o.*
|
Output: o.k, o.v, o.*
|
||||||
-> Result
|
-> Result
|
||||||
Output: 0, 'merge source SubPlan'::text
|
Output: 0, 'merge source SubPlan'::text
|
||||||
SubPlan 2
|
SubPlan expr_1
|
||||||
-> Limit
|
-> Limit
|
||||||
Output: ((cte_basic.b || ' merge update'::text))
|
Output: ((cte_basic.b || ' merge update'::text))
|
||||||
-> CTE Scan on cte_basic
|
-> CTE Scan on cte_basic
|
||||||
@@ -3235,7 +3235,7 @@ WHEN NOT MATCHED THEN INSERT VALUES(o.k, o.v);
|
|||||||
CTE cte_init
|
CTE cte_init
|
||||||
-> Result
|
-> Result
|
||||||
Output: 1, 'cte_init val'::text
|
Output: 1, 'cte_init val'::text
|
||||||
InitPlan 2
|
InitPlan expr_1
|
||||||
-> Limit
|
-> Limit
|
||||||
Output: ((cte_init.b || ' merge update'::text))
|
Output: ((cte_init.b || ' merge update'::text))
|
||||||
-> CTE Scan on cte_init
|
-> CTE Scan on cte_init
|
||||||
@@ -3278,11 +3278,11 @@ WHEN NOT MATCHED THEN INSERT VALUES(o.a, o.b || (SELECT merge_source_cte.*::text
|
|||||||
CTE merge_source_cte
|
CTE merge_source_cte
|
||||||
-> Result
|
-> Result
|
||||||
Output: 15, 'merge_source_cte val'::text
|
Output: 15, 'merge_source_cte val'::text
|
||||||
InitPlan 2
|
InitPlan expr_1
|
||||||
-> CTE Scan on merge_source_cte merge_source_cte_1
|
-> CTE Scan on merge_source_cte merge_source_cte_1
|
||||||
Output: ((merge_source_cte_1.b || (merge_source_cte_1.*)::text) || ' merge update'::text)
|
Output: ((merge_source_cte_1.b || (merge_source_cte_1.*)::text) || ' merge update'::text)
|
||||||
Filter: (merge_source_cte_1.a = 15)
|
Filter: (merge_source_cte_1.a = 15)
|
||||||
InitPlan 3
|
InitPlan expr_2
|
||||||
-> CTE Scan on merge_source_cte merge_source_cte_2
|
-> CTE Scan on merge_source_cte merge_source_cte_2
|
||||||
Output: ((merge_source_cte_2.*)::text || ' merge insert'::text)
|
Output: ((merge_source_cte_2.*)::text || ' merge insert'::text)
|
||||||
-> Hash Right Join
|
-> Hash Right Join
|
||||||
|
Reference in New Issue
Block a user