From ef9be8634350c7132e5a4a0f00676462b0e6e95c Mon Sep 17 00:00:00 2001 From: Jinbao Chen Date: Thu, 21 May 2020 23:10:37 +0800 Subject: [PATCH 1/5] Dispatch analyze to segments Now the system table pg_statisitics only has data in master. But the hash join skew hash need the some information in pg_statisitics. So we need to dispatch the analyze command to segment, So that the system table pg_statistics could have data in segments. --- src/backend/commands/analyze.c | 48 +++++++---- src/backend/commands/analyzefuncs.c | 85 +++++++------------ src/backend/commands/vacuum.c | 2 +- src/include/commands/vacuum.h | 45 +++++++++- src/test/regress/expected/bfv_statistic.out | 17 ++++ .../expected/bfv_statistic_optimizer.out | 17 ++++ src/test/regress/sql/bfv_statistic.sql | 11 +++ 7 files changed, 152 insertions(+), 73 deletions(-) diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 077a75d8917..6b636695391 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -167,8 +167,9 @@ Bitmapset **acquire_func_colLargeRowIndexes; static void do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, - AcquireSampleRowsFunc acquirefunc, BlockNumber relpages, - bool inh, bool in_outer_xact, int elevel); + BlockNumber relpages, + bool inh, bool in_outer_xact, int elevel, + gp_acquire_sample_rows_context *ctx); static void compute_index_stats(Relation onerel, double totalrows, AnlIndexData *indexdata, int nindexes, HeapTuple *rows, int numrows, @@ -187,8 +188,10 @@ static void update_attstats(Oid relid, bool inh, static Datum std_fetch_func(VacAttrStatsP stats, int rownum, bool *isNull); static Datum ind_fetch_func(VacAttrStatsP stats, int rownum, bool *isNull); + static void analyze_rel_internal(Oid relid, VacuumStmt *vacstmt, - bool in_outer_xact, BufferAccessStrategy bstrategy); + bool in_outer_xact, BufferAccessStrategy bstrategy, + gp_acquire_sample_rows_context *ctx); static void acquire_hll_by_query(Relation onerel, int nattrs, VacAttrStats **attrstats, int elevel); bool gp_use_fastanalyze; @@ -197,8 +200,9 @@ bool gp_use_fastanalyze; * analyze_rel() -- analyze one relation */ void -analyze_rel(Oid relid, VacuumStmt *vacstmt, - bool in_outer_xact, BufferAccessStrategy bstrategy) + +analyze_rel(Oid relid, VacuumStmt *vacstmt, bool in_outer_xact, + BufferAccessStrategy bstrategy, gp_acquire_sample_rows_context *ctx) { bool optimizerBackup; @@ -212,7 +216,8 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt, PG_TRY(); { - analyze_rel_internal(relid, vacstmt, in_outer_xact, bstrategy); + analyze_rel_internal(relid, vacstmt, + in_outer_xact, bstrategy, ctx); } /* Clean up in case of error. */ PG_CATCH(); @@ -228,8 +233,8 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt, } static void -analyze_rel_internal(Oid relid, VacuumStmt *vacstmt, - bool in_outer_xact, BufferAccessStrategy bstrategy) +analyze_rel_internal(Oid relid, VacuumStmt *vacstmt, bool in_outer_xact, + BufferAccessStrategy bstrategy, gp_acquire_sample_rows_context *ctx) { Relation onerel; int elevel; @@ -411,15 +416,16 @@ analyze_rel_internal(Oid relid, VacuumStmt *vacstmt, */ PartStatus ps = rel_part_status(relid); if (!(ps == PART_STATUS_ROOT || ps == PART_STATUS_INTERIOR)) - do_analyze_rel(onerel, vacstmt, acquirefunc, relpages, - false, in_outer_xact, elevel); + + do_analyze_rel(onerel, vacstmt, relpages, + false, in_outer_xact, elevel, ctx); /* * If there are child tables, do recursive ANALYZE. */ if (onerel->rd_rel->relhassubclass) - do_analyze_rel(onerel, vacstmt, acquirefunc, relpages, - true, in_outer_xact, elevel); + do_analyze_rel(onerel, vacstmt, relpages, + true, in_outer_xact, elevel, ctx); /* MPP-6929: metadata tracking */ if (!vacuumStatement_IsTemporary(onerel) && (Gp_role == GP_ROLE_DISPATCH)) @@ -464,8 +470,8 @@ analyze_rel_internal(Oid relid, VacuumStmt *vacstmt, */ static void do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, - AcquireSampleRowsFunc acquirefunc, BlockNumber relpages, - bool inh, bool in_outer_xact, int elevel) + BlockNumber relpages, bool inh, bool in_outer_xact, + int elevel, gp_acquire_sample_rows_context *ctx) { int attr_cnt, tcnt, @@ -682,6 +688,8 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, sample_needed = needs_sample(vacattrstats, attr_cnt); if (sample_needed) { + if (ctx) + MemoryContextSwitchTo(caller_context); rows = (HeapTuple *) palloc(targrows * sizeof(HeapTuple)); /* @@ -696,10 +704,12 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, rows, targrows, &totalrows, &totaldeadrows,vacstmt->options); else - numrows = (*acquirefunc) (onerel, elevel, + numrows = acquire_sample_rows (onerel, elevel, rows, targrows, &totalrows, &totaldeadrows); acquire_func_colLargeRowIndexes = NULL; + if (ctx) + MemoryContextSwitchTo(anl_context); } else { @@ -710,6 +720,14 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, rows = NULL; } + if (ctx) + { + ctx->sample_rows = rows; + ctx->num_sample_rows = numrows; + ctx->totalrows = totalrows; + ctx->totaldeadrows = totaldeadrows; + } + /* * Compute the statistics. Temporary results during the calculations for * each column are stored in a child context. The calc routines are diff --git a/src/backend/commands/analyzefuncs.c b/src/backend/commands/analyzefuncs.c index 12b1a94bdbf..26843c37348 100644 --- a/src/backend/commands/analyzefuncs.c +++ b/src/backend/commands/analyzefuncs.c @@ -8,6 +8,7 @@ #include "cdb/cdbaocsam.h" #include "cdb/cdbvars.h" #include "commands/vacuum.h" +#include "nodes/makefuncs.h" #include "storage/bufmgr.h" #include "utils/acl.h" #include "utils/builtins.h" @@ -24,29 +25,6 @@ bool gp_statistics_pullup_from_child_partition = FALSE; bool gp_statistics_use_fkeys = FALSE; -typedef struct -{ - /* Table being sampled */ - Relation onerel; - - /* Sampled rows and estimated total number of rows in the table. */ - HeapTuple *sample_rows; - int num_sample_rows; - double totalrows; - double totaldeadrows; - - /* - * Result tuple descriptor. Each returned row consists of three "fixed" - * columns, plus all the columns of the sampled table (excluding dropped - * columns). - */ - TupleDesc outDesc; -#define NUM_SAMPLE_FIXED_COLS 3 - - /* SRF state, to track which rows have already been returned. */ - int index; - bool summary_sent; -} gp_acquire_sample_rows_context; Datum gp_acquire_sample_rows_int(FunctionCallInfo fcinfo, Oid relOid,int32 targrows,bool inherited,int32 vacopts){ @@ -63,12 +41,10 @@ gp_acquire_sample_rows_int(FunctionCallInfo fcinfo, Oid relOid,int32 targrows,bo if (SRF_IS_FIRSTCALL()) { - double totalrows; - double totaldeadrows; Relation onerel; int attno; - int num_sample_rows; int outattno; + RangeVar *this_rangevar; funcctx = SRF_FIRSTCALL_INIT(); @@ -78,6 +54,9 @@ gp_acquire_sample_rows_int(FunctionCallInfo fcinfo, Oid relOid,int32 targrows,bo */ oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx); + /* Construct the context to keep across calls. */ + ctx = (gp_acquire_sample_rows_context *) palloc(sizeof(gp_acquire_sample_rows_context)); + if (!pg_class_ownercheck(relOid, GetUserId())) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CLASS, get_rel_name(relOid)); @@ -85,6 +64,30 @@ gp_acquire_sample_rows_int(FunctionCallInfo fcinfo, Oid relOid,int32 targrows,bo onerel = relation_open(relOid, AccessShareLock); relDesc = RelationGetDescr(onerel); + { + VacuumStmt vacstmt; + + /* Set up command parameters --- use local variables instead of palloc */ + MemSet(&vacstmt, 0, sizeof(vacstmt)); + + this_rangevar = makeRangeVar(get_namespace_name(onerel->rd_rel->relnamespace), + pstrdup(RelationGetRelationName(onerel)), + -1); + vacstmt.type = T_VacuumStmt; + vacstmt.options |= VACOPT_ANALYZE; + vacstmt.freeze_min_age = -1; + vacstmt.freeze_table_age = -1; + vacstmt.multixact_freeze_min_age = -1; + vacstmt.multixact_freeze_table_age = -1; + vacstmt.relation = &this_rangevar; + vacstmt.va_cols = NIL; + vacstmt.auto_stats = false; + analyze_rel(relOid, &vacstmt, + true, GetAccessStrategy(BAS_VACUUM), ctx); + + } + + /* Count the number of non-dropped cols */ live_natts = 0; for (attno = 1; attno <= relDesc->natts; attno++) @@ -144,37 +147,9 @@ gp_acquire_sample_rows_int(FunctionCallInfo fcinfo, Oid relOid,int32 targrows,bo BlessTupleDesc(outDesc); funcctx->tuple_desc = outDesc; - /* - * Collect the actual sample. (We do this only after blessing the output - * tuple, to avoid the very expensive work of scanning the table, if we're - * going to error out because of incorrect column definition, anyway. - * ANALYZE should always get this right, but makes testing manually a bit - * more comfortable.) - */ - sample_rows = (HeapTuple *) palloc0(targrows * sizeof(HeapTuple)); - if (inherited) - { - num_sample_rows = - acquire_inherited_sample_rows(onerel, DEBUG1, - sample_rows, targrows, - &totalrows, &totaldeadrows,vacopts); - } - else - { - num_sample_rows = - acquire_sample_rows(onerel, DEBUG1, sample_rows, targrows, - &totalrows, &totaldeadrows); - } - - /* Construct the context to keep across calls. */ - ctx = (gp_acquire_sample_rows_context *) palloc(sizeof(gp_acquire_sample_rows_context)); ctx->onerel = onerel; funcctx->user_fctx = ctx; ctx->outDesc = outDesc; - ctx->sample_rows = sample_rows; - ctx->num_sample_rows = num_sample_rows; - ctx->totalrows = totalrows; - ctx->totaldeadrows = totaldeadrows; ctx->index = 0; ctx->summary_sent = false; @@ -194,7 +169,7 @@ gp_acquire_sample_rows_int(FunctionCallInfo fcinfo, Oid relOid,int32 targrows,bo HeapTuple res; /* First return all the sample rows */ - if (ctx->index < ctx->num_sample_rows) + if (ctx->index < ctx->num_sample_rows && ctx->index < targrows) { HeapTuple relTuple = ctx->sample_rows[ctx->index]; int attno; diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 0f088f32fec..9a5eb60b998 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -399,7 +399,7 @@ vacuum(VacuumStmt *vacstmt, Oid relid, bool do_toast, PushActiveSnapshot(GetTransactionSnapshot()); } - analyze_rel(relid, vacstmt, in_outer_xact, vac_strategy); + analyze_rel(relid, vacstmt, in_outer_xact, vac_strategy, NULL); if (use_own_xacts) { diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index f14362a36e5..860afb92bd0 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -162,6 +162,47 @@ typedef struct VPgClassStats BlockNumber relallvisible; } VPgClassStats; +/* + * Parameters customizing behavior of VACUUM and ANALYZE. + */ +typedef struct VacuumParams +{ + int freeze_min_age; /* min freeze age, -1 to use default */ + int freeze_table_age; /* age at which to scan whole table */ + int multixact_freeze_min_age; /* min multixact freeze age, + * -1 to use default */ + int multixact_freeze_table_age; /* multixact age at which to + * scan whole table */ + bool is_wraparound; /* force a for-wraparound vacuum */ + int log_min_duration; /* minimum execution threshold in ms + * at which verbose logs are + * activated, -1 to use default */ +} VacuumParams; + +typedef struct +{ + /* Table being sampled */ + Relation onerel; + + /* Sampled rows and estimated total number of rows in the table. */ + HeapTuple *sample_rows; + int num_sample_rows; + double totalrows; + double totaldeadrows; + + /* + * Result tuple descriptor. Each returned row consists of three "fixed" + * columns, plus all the columns of the sampled table (excluding dropped + * columns). + */ + TupleDesc outDesc; +#define NUM_SAMPLE_FIXED_COLS 3 + + /* SRF state, to track which rows have already been returned. */ + int index; + bool summary_sent; +} gp_acquire_sample_rows_context; + /* GUC parameters */ extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for * PostGIS */ @@ -219,8 +260,8 @@ extern int vacuum_appendonly_indexes(Relation aoRelation, VacuumStmt *vacstmt, B extern void vacuum_aocs_rel(Relation aorel, void *vacrelstats, bool isVacFull); /* in commands/analyze.c */ -extern void analyze_rel(Oid relid, VacuumStmt *vacstmt, - bool in_outer_xact, BufferAccessStrategy bstrategy); +extern void analyze_rel(Oid relid,VacuumStmt *vacstmt, bool in_outer_xact, + BufferAccessStrategy bstrategy, gp_acquire_sample_rows_context *ctx); extern void analyzeStatement(VacuumStmt *vacstmt, List *relids, BufferAccessStrategy start, bool isTopLevel); extern bool std_typanalyze(VacAttrStats *stats); diff --git a/src/test/regress/expected/bfv_statistic.out b/src/test/regress/expected/bfv_statistic.out index 0d8579a0388..71132b190cf 100644 --- a/src/test/regress/expected/bfv_statistic.out +++ b/src/test/regress/expected/bfv_statistic.out @@ -478,3 +478,20 @@ explain select * from tiny_freq where a=12; (4 rows) RESET optimizer_trace_fallback; +-- Test if the table pg_statistic has data in segments +DROP TABLE IF EXISTS test_statistic_1; +CREATE TABLE test_statistic_1(a int, b int); +INSERT INTO test_statistic_1 SELECT i, i FROM generate_series(1, 1000)i; +select count(*) from pg_class c, pg_statistic s where c.oid = s.starelid and relname = 'test_statistic_1'; + count +------- + 2 +(1 row) + +select count(*) from pg_class c, gp_dist_random('pg_statistic') s where c.oid = s.starelid and relname = 'test_statistic_1'; + count +------- + 6 +(1 row) + +DROP TABLE test_statistic_1; diff --git a/src/test/regress/expected/bfv_statistic_optimizer.out b/src/test/regress/expected/bfv_statistic_optimizer.out index 4d8ebfb5770..4365573ae77 100644 --- a/src/test/regress/expected/bfv_statistic_optimizer.out +++ b/src/test/regress/expected/bfv_statistic_optimizer.out @@ -506,3 +506,20 @@ explain select * from tiny_freq where a=12; (4 rows) RESET optimizer_trace_fallback; +-- Test if the table pg_statistic has data in segments +DROP TABLE IF EXISTS test_statistic_1; +CREATE TABLE test_statistic_1(a int, b int); +INSERT INTO test_statistic_1 SELECT i, i FROM generate_series(1, 1000)i; +select count(*) from pg_class c, pg_statistic s where c.oid = s.starelid and relname = 'test_statistic_1'; + count +------- + 2 +(1 row) + +select count(*) from pg_class c, gp_dist_random('pg_statistic') s where c.oid = s.starelid and relname = 'test_statistic_1'; + count +------- + 6 +(1 row) + +DROP TABLE test_statistic_1; diff --git a/src/test/regress/sql/bfv_statistic.sql b/src/test/regress/sql/bfv_statistic.sql index 4353b92789c..4c94ecf0d10 100644 --- a/src/test/regress/sql/bfv_statistic.sql +++ b/src/test/regress/sql/bfv_statistic.sql @@ -384,3 +384,14 @@ reset allow_system_table_mods; explain select * from tiny_freq where a=12; RESET optimizer_trace_fallback; + +-- Test if the table pg_statistic has data in segments + +DROP TABLE IF EXISTS test_statistic_1; +CREATE TABLE test_statistic_1(a int, b int); +INSERT INTO test_statistic_1 SELECT i, i FROM generate_series(1, 1000)i; + +select count(*) from pg_class c, pg_statistic s where c.oid = s.starelid and relname = 'test_statistic_1'; +select count(*) from pg_class c, gp_dist_random('pg_statistic') s where c.oid = s.starelid and relname = 'test_statistic_1'; + +DROP TABLE test_statistic_1; From c6b234e3384d7fdf8432c78bc4ece5bba7712933 Mon Sep 17 00:00:00 2001 From: Victor Kremensky Date: Fri, 25 Jul 2025 06:39:47 +0000 Subject: [PATCH 2/5] try fix analyze on seg --- src/backend/commands/analyze.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 6b636695391..1912faf9976 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -1802,6 +1802,8 @@ acquire_sample_rows(Relation onerel, int elevel, else if (RelationIsAppendOptimized(onerel)) return acquire_sample_rows_ao(onerel, elevel, rows, targrows, totalrows, totaldeadrows); + else if (RelationIsForeign(onerel)) + return 0; else elog(ERROR, "unsupported table type"); } From a08c31ee0cf297eb5f19d434b243090f8306b0f6 Mon Sep 17 00:00:00 2001 From: Victor Kremensky Date: Mon, 28 Jul 2025 11:43:55 +0000 Subject: [PATCH 3/5] changes in tests? --- src/test/regress/expected/gporca.out | 5365 ++++++++++++----------- src/test/regress/expected/vacuum_gp.out | 17 +- 2 files changed, 2728 insertions(+), 2654 deletions(-) diff --git a/src/test/regress/expected/gporca.out b/src/test/regress/expected/gporca.out index 06c4155876f..0e54173c422 100644 --- a/src/test/regress/expected/gporca.out +++ b/src/test/regress/expected/gporca.out @@ -18,8 +18,13 @@ set optimizer_segments = 3; set optimizer_enable_master_only_queries = on; -- master only tables create schema orca; +-- start_ignore +GRANT ALL ON SCHEMA orca TO PUBLIC; +SET search_path to orca, public; +-- end_ignore create table orca.r(); NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suitable for a distribution key. Creating a NULL policy entry. +WARNING: creating a table with no columns. set allow_system_table_mods=true; delete from gp_distribution_policy where localoid='orca.r'::regclass; reset allow_system_table_mods; @@ -28,6 +33,7 @@ alter table orca.r add column b int; insert into orca.r select i, i/3 from generate_series(1,20) i; create table orca.s(); NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suitable for a distribution key. Creating a NULL policy entry. +WARNING: creating a table with no columns. set allow_system_table_mods=true; delete from gp_distribution_policy where localoid='orca.s'::regclass; reset allow_system_table_mods; @@ -714,26 +720,26 @@ select count(*) from orca.r; select a, b from orca.r, orca.s group by a,b; a | b ----+--- - 13 | 4 - 9 | 3 - 5 | 1 - 16 | 5 12 | 4 - 17 | 5 + 5 | 1 + 8 | 2 + 3 | 1 + 13 | 4 4 | 1 - 18 | 6 + 19 | 6 + 15 | 5 10 | 3 - 8 | 2 + 2 | 0 6 | 2 - 15 | 5 - 19 | 6 14 | 4 - 3 | 1 - 2 | 0 + 16 | 5 + 18 | 6 + 1 | 0 11 | 3 7 | 2 + 9 | 3 20 | 6 - 1 | 0 + 17 | 5 (20 rows) select r.a+1 from orca.r; @@ -1903,23 +1909,23 @@ select pow(r.b,r.a) from orca.r; select b from orca.r group by b having count(*) > 2; b --- - 6 + 5 1 - 4 + 6 2 + 4 3 - 5 (6 rows) select b from orca.r group by b having count(*) <= avg(a) + (select count(*) from orca.s where s.c = r.b); b --- - 6 + 5 1 - 4 + 6 2 + 4 3 - 5 (6 rows) select sum(a) from orca.r group by b having count(*) > 2 order by b+1; @@ -2158,15 +2164,15 @@ insert into orca.bar2 select i,i+1,i+2 from generate_series(1,30) i; select x2 from orca.foo where x1 in (select x2 from orca.bar1); x2 ---- - 4 - 5 6 7 - 8 - 3 - 9 10 11 + 3 + 4 + 5 + 8 + 9 (9 rows) select 1; @@ -2232,46 +2238,46 @@ select distinct 1, sum(x1) from orca.foo; select distinct x1, rank() over(order by x1) from (select x1 from orca.foo order by x1) x; --order none x1 | rank ----+------ + 4 | 4 + 10 | 10 + 9 | 9 + 3 | 3 1 | 1 2 | 2 - 3 | 3 - 4 | 4 - 5 | 5 + 8 | 8 6 | 6 7 | 7 - 8 | 8 - 9 | 9 - 10 | 10 + 5 | 5 (10 rows) select distinct x1, sum(x3) from orca.foo group by x1,x2; x1 | sum ----+----- - 1 | 3 - 2 | 4 - 3 | 5 + 10 | 12 + 9 | 11 4 | 6 + 3 | 5 + 8 | 10 + 1 | 3 5 | 7 - 6 | 8 7 | 9 - 8 | 10 - 9 | 11 - 10 | 12 + 2 | 4 + 6 | 8 (10 rows) select distinct s from (select sum(x2) s from orca.foo group by x1) x; s ---- - 9 - 8 - 11 - 10 - 2 7 - 6 + 2 4 + 8 3 5 + 11 + 10 + 6 + 9 (10 rows) select * from orca.foo a where a.x1 = (select distinct sum(b.x1)+avg(b.x1) sa from orca.bar1 b group by b.x3 order by sa limit 1); @@ -2290,32 +2296,32 @@ select distinct a.x1 from orca.foo a where a.x1 <= (select distinct sum(b.x1)+av select * from orca.foo a where a.x1 = (select distinct b.x1 from orca.bar1 b where b.x1=a.x1 limit 1); x1 | x2 | x3 ----+----+---- - 1 | 2 | 3 - 2 | 3 | 4 - 8 | 9 | 10 + 5 | 6 | 7 + 6 | 7 | 8 9 | 10 | 11 10 | 11 | 12 + 1 | 2 | 3 + 2 | 3 | 4 3 | 4 | 5 4 | 5 | 6 - 5 | 6 | 7 - 6 | 7 | 8 7 | 8 | 9 + 8 | 9 | 10 (10 rows) -- with clause with cte1 as (select * from orca.foo) select a.x1+1 from (select * from cte1) a group by a.x1; ?column? ---------- - 2 - 3 8 - 7 + 3 5 + 9 4 6 - 10 - 9 11 + 7 + 10 + 2 (10 rows) select count(*)+1 from orca.bar1 b where b.x1 < any (with cte1 as (select * from orca.foo) select a.x1+1 from (select * from cte1) a group by a.x1); @@ -2390,12 +2396,12 @@ explain select case when bar1.x2 = bar2.x2 then coalesce((select 1 from orca.foo from orca.bar1 inner join orca.bar2 on (bar1.x2 = bar2.x2) order by bar1.x1; QUERY PLAN --------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice4; segments: 3) (cost=72.61..72.66 rows=20 width=12) + Gather Motion 3:1 (slice4; segments: 3) (cost=72.59..72.64 rows=20 width=12) Merge Key: bar1.x1 - -> Sort (cost=72.61..72.66 rows=7 width=12) + -> Sort (cost=72.59..72.64 rows=7 width=12) Sort Key: bar1.x1 - -> Hash Join (cost=3.85..72.17 rows=7 width=12) - Hash Cond: bar2.x2 = bar1.x2 + -> Hash Join (cost=3.85..72.16 rows=7 width=12) + Hash Cond: (bar2.x2 = bar1.x2) -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..3.90 rows=10 width=4) Hash Key: bar2.x2 -> Seq Scan on bar2 (cost=0.00..3.30 rows=10 width=4) @@ -2403,17 +2409,16 @@ from orca.bar1 inner join orca.bar2 on (bar1.x2 = bar2.x2) order by bar1.x1; -> Redistribute Motion 3:3 (slice3; segments: 3) (cost=0.00..3.60 rows=7 width=8) Hash Key: bar1.x2 -> Seq Scan on bar1 (cost=0.00..3.20 rows=7 width=8) - SubPlan 1 + SubPlan 1 (slice4; segments: 3) -> Result (cost=0.00..3.20 rows=1 width=0) - One-Time Filter: $0 = $1 - -> Result (cost=3.20..3.21 rows=1 width=0) - Filter: foo.x2 = $1 AND $0::double precision = random() - -> Materialize (cost=3.20..3.21 rows=1 width=0) + One-Time Filter: (bar1.x2 = bar2.x2) + -> Result (cost=0.00..3.21 rows=1 width=0) + Filter: ((foo.x2 = bar2.x2) AND ((bar1.x2)::double precision = random())) + -> Materialize (cost=0.00..3.21 rows=1 width=0) -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..3.20 rows=1 width=0) -> Seq Scan on foo (cost=0.00..3.20 rows=1 width=0) - Settings: optimizer=off; optimizer_segments=3 - Optimizer status: Postgres query optimizer -(23 rows) + Optimizer: Postgres query optimizer +(22 rows) select case when bar1.x2 = bar2.x2 then coalesce((select 1 from orca.foo where bar1.x2 = bar2.x2 and bar1.x2 = random() and foo.x2 = bar2.x2),0) else 1 end as col1, bar1.x1 from orca.bar1 inner join orca.bar2 on (bar1.x2 = bar2.x2) order by bar1.x1; @@ -2455,648 +2460,713 @@ select * from orca.r, orca.s where r.a=s.c; a | b | c | d ---+---+---+--- 1 | 1 | 1 | 1 - 2 | 2 | 2 | 0 1 | 1 | 1 | 0 - 2 | 2 | 2 | 1 1 | 1 | 1 | 1 - 2 | 2 | 2 | 0 1 | 1 | 1 | 0 - 2 | 2 | 2 | 1 1 | 1 | 1 | 1 + 5 | 2 | 5 | 1 + 6 | 0 | 6 | 0 + 5 | 2 | 5 | 0 + 6 | 0 | 6 | 1 + 5 | 2 | 5 | 1 + 6 | 0 | 6 | 0 + 5 | 2 | 5 | 0 + 6 | 0 | 6 | 1 2 | 2 | 2 | 0 3 | 0 | 3 | 1 4 | 1 | 4 | 0 - 5 | 2 | 5 | 1 - 6 | 0 | 6 | 0 + 2 | 2 | 2 | 1 3 | 0 | 3 | 0 4 | 1 | 4 | 1 - 5 | 2 | 5 | 0 - 6 | 0 | 6 | 1 + 2 | 2 | 2 | 0 3 | 0 | 3 | 1 4 | 1 | 4 | 0 - 5 | 2 | 5 | 1 - 6 | 0 | 6 | 0 + 2 | 2 | 2 | 1 3 | 0 | 3 | 0 4 | 1 | 4 | 1 - 5 | 2 | 5 | 0 - 6 | 0 | 6 | 1 + 2 | 2 | 2 | 0 (26 rows) -- Materialize node select * from orca.r, orca.s where r.as.c; a | b | c | d ----+---+---+--- + 1 | 1 | 2 | 0 + 12 | 0 | 2 | 0 + 15 | 0 | 2 | 0 + 20 | 2 | 2 | 0 + 2 | 2 | 2 | 0 + 3 | 0 | 2 | 0 + 4 | 1 | 2 | 0 + 7 | 1 | 2 | 0 + 8 | 2 | 2 | 0 + 16 | 1 | 2 | 0 + 18 | 0 | 2 | 0 + 19 | 1 | 2 | 0 + 5 | 2 | 2 | 0 + 6 | 0 | 2 | 0 + 9 | 0 | 2 | 0 + 10 | 1 | 2 | 0 + 11 | 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 + 1 | 1 + 1 | 1 + 1 | 1 + 1 | 1 + 12 | 0 + 12 | 0 + 12 | 0 + 12 | 0 + 12 | 0 + 15 | 0 + 15 | 0 + 15 | 0 + 15 | 0 + 15 | 0 + 20 | 2 + 20 | 2 + 20 | 2 + 20 | 2 + 20 | 2 + 5 | 2 + 5 | 2 + 5 | 2 + 5 | 2 + 5 | 2 + 6 | 0 + 6 | 0 + 6 | 0 + 6 | 0 + 6 | 0 9 | 0 9 | 0 9 | 0 @@ -3108,25 +3178,10 @@ select r.* from orca.r, orca.s where s.c=2; 10 | 1 10 | 1 11 | 2 - 11 | 2 - 11 | 2 - 11 | 2 - 11 | 2 - 12 | 0 - 12 | 0 - 12 | 0 - 12 | 0 - 12 | 0 - 1 | 1 - 1 | 1 - 1 | 1 - 1 | 1 - 1 | 1 - 2 | 2 - 2 | 2 - 2 | 2 - 2 | 2 - 2 | 2 + 11 | 2 + 11 | 2 + 11 | 2 + 11 | 2 13 | 1 13 | 1 13 | 1 @@ -3137,69 +3192,21 @@ select r.* from orca.r, orca.s where s.c=2; 14 | 2 14 | 2 14 | 2 - 15 | 0 - 15 | 0 - 15 | 0 - 15 | 0 - 15 | 0 - 16 | 1 - 16 | 1 - 16 | 1 - 16 | 1 - 16 | 1 17 | 2 17 | 2 17 | 2 17 | 2 17 | 2 - 3 | 0 - 3 | 0 - 3 | 0 - 3 | 0 - 3 | 0 - 4 | 1 - 4 | 1 - 4 | 1 - 4 | 1 - 4 | 1 - 5 | 2 - 5 | 2 - 5 | 2 - 5 | 2 - 5 | 2 - 6 | 0 - 6 | 0 - 6 | 0 - 6 | 0 - 6 | 0 - 7 | 1 - 7 | 1 - 7 | 1 - 7 | 1 - 7 | 1 - 18 | 0 - 18 | 0 - 18 | 0 - 18 | 0 - 18 | 0 - 19 | 1 - 19 | 1 - 19 | 1 - 19 | 1 - 19 | 1 - 20 | 2 - 20 | 2 - 20 | 2 - 20 | 2 - 20 | 2 (100 rows) create table orca.m(); NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suitable for a distribution key. Creating a NULL policy entry. +WARNING: creating a table with no columns. alter table orca.m add column a int; alter table orca.m add column b int; create table orca.m1(); NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suitable for a distribution key. Creating a NULL policy entry. +WARNING: creating a table with no columns. alter table orca.m1 add column a int; alter table orca.m1 add column b int; insert into orca.m select i-1, i%2 from generate_series(1,35) i; @@ -3214,42 +3221,42 @@ select r.a, s.c from orca.r left outer join orca.s on(r.a=s.c); 1 | 1 1 | 1 1 | 1 - 2 | 2 - 2 | 2 - 2 | 2 - 2 | 2 - 2 | 2 + 20 | + 15 | + 12 | + 5 | 5 + 6 | 6 + 5 | 5 + 6 | 6 + 5 | 5 + 6 | 6 + 5 | 5 + 6 | 6 13 | 14 | - 15 | - 16 | - 17 | - 8 | - 9 | - 10 | 11 | - 12 | - 3 | 3 - 3 | 3 - 3 | 3 + 10 | + 9 | + 17 | + 2 | 2 3 | 3 4 | 4 + 2 | 2 + 3 | 3 4 | 4 + 2 | 2 + 3 | 3 4 | 4 + 2 | 2 + 3 | 3 4 | 4 - 5 | 5 - 5 | 5 - 5 | 5 - 5 | 5 - 6 | 6 - 6 | 6 - 6 | 6 - 6 | 6 - 7 | + 2 | 2 + | 18 | + 7 | + 16 | + 8 | 19 | - 20 | - | (41 rows) select r.a, s.c from orca.r left outer join orca.s on(r.a=s.c and r.a=r.b and s.c=s.d) order by r.a,s.c; @@ -3303,34 +3310,34 @@ select r.a, s.c from orca.r left outer join orca.s on(r.a=s.c) where s.d > 2 or select r.a, s.c from orca.r right outer join orca.s on(r.a=s.c); a | c ---+--- - 1 | 1 2 | 2 + 3 | 3 + 4 | 4 + 2 | 2 + 3 | 3 + 4 | 4 + 2 | 2 + 3 | 3 + 4 | 4 + 2 | 2 + 3 | 3 + 4 | 4 + 2 | 2 + 1 | 1 | 0 1 | 1 - 2 | 2 | 0 1 | 1 - 2 | 2 | 0 1 | 1 - 2 | 2 | 0 1 | 1 - 2 | 2 - 3 | 3 - 4 | 4 5 | 5 6 | 6 - 3 | 3 - 4 | 4 5 | 5 6 | 6 - 3 | 3 - 4 | 4 5 | 5 6 | 6 - 3 | 3 - 4 | 4 5 | 5 6 | 6 (30 rows) @@ -3338,98 +3345,98 @@ select r.a, s.c from orca.r right outer join orca.s on(r.a=s.c); select * from orca.r where exists (select * from orca.s where s.c=r.a + 2); a | b ---+--- - 1 | 1 - 2 | 2 3 | 0 4 | 1 + 2 | 2 + 1 | 1 (4 rows) select * from orca.r where exists (select * from orca.s where s.c=r.b); a | b ----+--- - 1 | 1 - 2 | 2 - 13 | 1 + 20 | 2 + 5 | 2 + 11 | 2 14 | 2 - 15 | 0 - 16 | 1 17 | 2 + 2 | 2 + 8 | 2 + 1 | 1 + 12 | 0 + 15 | 0 + 6 | 0 + 9 | 0 + 10 | 1 + 13 | 1 3 | 0 4 | 1 - 5 | 2 - 6 | 0 7 | 1 + 16 | 1 18 | 0 19 | 1 - 20 | 2 | 1 - 8 | 2 - 9 | 0 - 10 | 1 - 11 | 2 - 12 | 0 (21 rows) select * from orca.m where m.a not in (select a from orca.m1 where a=5); a | b ----+--- - 0 | 1 1 | 0 - 3 | 0 - 4 | 1 - 8 | 1 - 9 | 0 - 15 | 0 - 23 | 0 - 30 | 1 2 | 1 6 | 1 7 | 0 + 8 | 1 10 | 1 - 11 | 0 + 12 | 1 13 | 0 + 15 | 0 16 | 1 - 17 | 0 - 18 | 1 - 20 | 1 21 | 0 22 | 1 - 24 | 1 26 | 1 27 | 0 + 29 | 0 + 3 | 0 + 4 | 1 + 9 | 0 + 19 | 0 + 20 | 1 + 23 | 0 + 24 | 1 + 28 | 1 + 30 | 1 31 | 0 32 | 1 - 12 | 1 + 33 | 0 + 0 | 1 + 11 | 0 14 | 1 - 19 | 0 + 17 | 0 + 18 | 1 25 | 0 - 28 | 1 - 29 | 0 - 33 | 0 34 | 1 (34 rows) select * from orca.m where m.a not in (select a from orca.m1); a | b ----+--- - 30 | 1 - 25 | 0 - 28 | 1 + 26 | 1 + 27 | 0 29 | 0 - 33 | 0 + 25 | 0 34 | 1 24 | 1 - 26 | 1 - 27 | 0 + 28 | 1 + 30 | 1 31 | 0 32 | 1 + 33 | 0 (11 rows) select * from orca.m where m.a in (select a from orca.m1 where m1.a-1 = m.b); a | b ---+--- - 2 | 1 1 | 0 + 2 | 1 (2 rows) -- enable_hashjoin=off; enable_mergejoin=on @@ -3458,25 +3465,25 @@ select 1 from orca.m, orca.m1 where m.a = m1.a and m.b!=m1.b; select * from orca.r left outer join orca.s on (r.a=s.c and r.b Nested Loop (cost=10000000000.00..10000000030.55 rows=11 width=16) - Join Filter: NOT r.a IS DISTINCT FROM s.c - -> Seq Scan on s (cost=0.00..2.30 rows=10 width=8) + Gather Motion 3:1 (slice2; segments: 3) (cost=10000000000.00..10000000031.55 rows=31 width=16) + -> Nested Loop (cost=10000000000.00..10000000031.55 rows=11 width=16) + Join Filter: (NOT (r.a IS DISTINCT FROM s.c)) + -> Seq Scan on s (cost=0.00..3.30 rows=10 width=8) -> Materialize (cost=0.00..4.30 rows=20 width=8) -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..4.00 rows=20 width=8) -> Seq Scan on r (cost=0.00..3.20 rows=7 width=8) @@ -3498,17 +3505,16 @@ explain select * from orca.r, orca.s where r.a is not distinct from s.c; -- explain Hash Join with equality join condition -- force_explain explain select * from orca.r, orca.s where r.a = s.c; - QUERY PLAN + QUERY PLAN ------------------------------------------------------------------------------ - Gather Motion 3:1 (slice1; segments: 3) (cost=3.45..6.20 rows=30 width=16) - -> Hash Join (cost=3.45..6.20 rows=10 width=16) - Hash Cond: s.c = r.a - -> Seq Scan on s (cost=0.00..2.30 rows=10 width=8) + Gather Motion 3:1 (slice1; segments: 3) (cost=3.45..7.16 rows=30 width=16) + -> Hash Join (cost=3.45..7.16 rows=10 width=16) + Hash Cond: (s.c = r.a) + -> Seq Scan on s (cost=0.00..3.30 rows=10 width=8) -> Hash (cost=3.20..3.20 rows=7 width=8) -> Seq Scan on r (cost=0.00..3.20 rows=7 width=8) - Settings: optimizer=off; optimizer_segments=3 - Optimizer status: Postgres query optimizer -(8 rows) + Optimizer: Postgres query optimizer +(7 rows) -- sort select * from orca.r join orca.s on(r.a=s.c) order by r.a, s.d; @@ -3629,459 +3635,459 @@ select * from ((select a as x from orca.r) union (select 1 as x )) as foo order 20 (21 rows) - -insert into orca.m values (1,-1), (1,2), (1,1); --- computed columns -select a,a,a+b from orca.m; - a | a | ?column? -----+----+---------- - 12 | 12 | 13 - 14 | 14 | 15 - 19 | 19 | 19 - 25 | 25 | 25 - 28 | 28 | 29 - 29 | 29 | 29 - 33 | 33 | 33 - 34 | 34 | 35 - 1 | 1 | 0 - 0 | 0 | 1 + +insert into orca.m values (1,-1), (1,2), (1,1); +-- computed columns +select a,a,a+b from orca.m; + a | a | ?column? +----+----+---------- 1 | 1 | 1 - 3 | 3 | 3 - 4 | 4 | 5 - 8 | 8 | 9 - 9 | 9 | 9 - 15 | 15 | 15 - 23 | 23 | 23 - 30 | 30 | 31 - 1 | 1 | 2 2 | 2 | 3 - 5 | 5 | 5 6 | 6 | 7 7 | 7 | 7 + 8 | 8 | 9 10 | 10 | 11 - 11 | 11 | 11 + 12 | 12 | 13 13 | 13 | 13 + 15 | 15 | 15 16 | 16 | 17 - 17 | 17 | 17 - 18 | 18 | 19 - 20 | 20 | 21 21 | 21 | 21 22 | 22 | 23 - 24 | 24 | 25 26 | 26 | 27 27 | 27 | 27 + 29 | 29 | 29 + 1 | 1 | 3 + 3 | 3 | 3 + 4 | 4 | 5 + 9 | 9 | 9 + 19 | 19 | 19 + 20 | 20 | 21 + 23 | 23 | 23 + 24 | 24 | 25 + 28 | 28 | 29 + 30 | 30 | 31 31 | 31 | 31 32 | 32 | 33 - 1 | 1 | 3 + 33 | 33 | 33 + 1 | 1 | 0 + 1 | 1 | 2 + 0 | 0 | 1 + 5 | 5 | 5 + 11 | 11 | 11 + 14 | 14 | 15 + 17 | 17 | 17 + 18 | 18 | 19 + 25 | 25 | 25 + 34 | 34 | 35 (38 rows) select a,a+b,a+b from orca.m; a | ?column? | ?column? ----+----------+---------- - 12 | 13 | 13 + 0 | 1 | 1 + 5 | 5 | 5 + 11 | 11 | 11 14 | 15 | 15 - 19 | 19 | 19 + 17 | 17 | 17 + 18 | 19 | 19 25 | 25 | 25 - 28 | 29 | 29 - 29 | 29 | 29 - 33 | 33 | 33 34 | 35 | 35 - 1 | 0 | 0 - 0 | 1 | 1 1 | 1 | 1 - 3 | 3 | 3 - 4 | 5 | 5 - 8 | 9 | 9 - 9 | 9 | 9 - 15 | 15 | 15 - 23 | 23 | 23 - 30 | 31 | 31 - 1 | 2 | 2 2 | 3 | 3 - 5 | 5 | 5 6 | 7 | 7 7 | 7 | 7 + 8 | 9 | 9 10 | 11 | 11 - 11 | 11 | 11 + 12 | 13 | 13 13 | 13 | 13 + 15 | 15 | 15 16 | 17 | 17 - 17 | 17 | 17 - 18 | 19 | 19 - 20 | 21 | 21 21 | 21 | 21 22 | 23 | 23 - 24 | 25 | 25 26 | 27 | 27 27 | 27 | 27 + 29 | 29 | 29 + 1 | 3 | 3 + 3 | 3 | 3 + 4 | 5 | 5 + 9 | 9 | 9 + 19 | 19 | 19 + 20 | 21 | 21 + 23 | 23 | 23 + 24 | 25 | 25 + 28 | 29 | 29 + 30 | 31 | 31 31 | 31 | 31 32 | 33 | 33 - 1 | 3 | 3 + 33 | 33 | 33 + 1 | 0 | 0 + 1 | 2 | 2 (38 rows) -- func expr select * from orca.m where a=abs(b); a | b ---+---- - 1 | 1 1 | -1 + 1 | 1 (2 rows) -- grouping sets select a,b,count(*) from orca.m group by grouping sets ((a), (a,b)); a | b | count ----+----+------- - 13 | | 1 - 12 | | 1 - 24 | 1 | 1 - 16 | 1 | 1 + 0 | 1 | 1 + 13 | 0 | 1 + 34 | | 1 + 33 | 0 | 1 + 19 | 0 | 1 + 20 | | 1 + 29 | | 1 + 16 | | 1 + 25 | | 1 + 15 | | 1 + 1 | 0 | 1 + 18 | 1 | 1 6 | 1 | 1 - 14 | | 1 - 20 | 1 | 1 + 25 | 0 | 1 + 22 | 1 | 1 + 18 | | 1 + 29 | 0 | 1 + 8 | 1 | 1 + 19 | | 1 + 32 | 1 | 1 + 23 | 0 | 1 + 4 | 1 | 1 + 24 | | 1 2 | 1 | 1 - 16 | | 1 - 31 | 0 | 1 + 12 | | 1 + 5 | | 1 + 4 | | 1 + 1 | 1 | 1 + 33 | | 1 + 26 | | 1 + 28 | | 1 27 | 0 | 1 - 13 | 0 | 1 - 9 | 0 | 1 17 | | 1 - 32 | | 1 - 17 | 0 | 1 - 3 | | 1 34 | 1 | 1 - 19 | | 1 - 11 | | 1 - 9 | | 1 - 31 | | 1 - 28 | 1 | 1 + 23 | | 1 + 1 | 2 | 1 + 12 | 1 | 1 + 21 | | 1 + 7 | | 1 + 3 | | 1 + 31 | 0 | 1 10 | 1 | 1 - 18 | 1 | 1 - 21 | 0 | 1 + 32 | | 1 + 7 | 0 | 1 8 | | 1 - 32 | 1 | 1 - 25 | 0 | 1 - 29 | 0 | 1 0 | | 1 - 18 | | 1 - 2 | | 1 - 14 | 1 | 1 - 7 | 0 | 1 30 | | 1 - 27 | | 1 - 5 | | 1 - 3 | 0 | 1 - 11 | 0 | 1 - 0 | 1 | 1 - 26 | | 1 - 4 | | 1 - 34 | | 1 - 22 | 1 | 1 + 20 | 1 | 1 + 13 | | 1 + 24 | 1 | 1 1 | -1 | 1 - 28 | | 1 - 19 | 0 | 1 - 1 | 2 | 1 - 10 | | 1 - 23 | | 1 - 1 | 1 | 1 - 15 | | 1 - 8 | 1 | 1 - 30 | 1 | 1 - 25 | | 1 - 21 | | 1 - 33 | | 1 - 12 | 1 | 1 - 20 | | 1 - 24 | | 1 1 | | 4 - 15 | 0 | 1 - 6 | | 1 - 29 | | 1 - 7 | | 1 - 1 | 0 | 1 - 5 | 0 | 1 + 16 | 1 | 1 + 31 | | 1 + 14 | 1 | 1 26 | 1 | 1 - 4 | 1 | 1 - 33 | 0 | 1 + 5 | 0 | 1 + 9 | | 1 + 11 | 0 | 1 + 6 | | 1 + 14 | | 1 + 28 | 1 | 1 + 15 | 0 | 1 + 11 | | 1 + 21 | 0 | 1 + 9 | 0 | 1 + 10 | | 1 + 30 | 1 | 1 + 27 | | 1 22 | | 1 - 23 | 0 | 1 + 17 | 0 | 1 + 3 | 0 | 1 + 2 | | 1 (73 rows) select b,count(*) from orca.m group by grouping sets ((a), (a,b)); b | count ----+------- - | 1 1 | 1 - -1 | 1 - | 1 0 | 1 - 2 | 1 | 1 + 0 | 1 + 0 | 1 | 1 - 1 | 1 | 1 - 1 | 1 - 1 | 1 | 1 | 1 | 1 + 0 | 1 + 1 | 1 1 | 1 - | 1 - | 1 - | 4 0 | 1 | 1 - | 1 + 1 | 1 | 1 0 | 1 - 0 | 1 1 | 1 1 | 1 0 | 1 + 1 | 1 + | 1 + 1 | 1 | 1 - 0 | 1 | 1 | 1 1 | 1 - 1 | 1 - 1 | 1 | 1 + | 1 + | 1 + | 1 + 0 | 1 1 | 1 + | 1 + 2 | 1 1 | 1 | 1 - 0 | 1 - 0 | 1 - 0 | 1 - 0 | 1 | 1 + | 1 + 0 | 1 1 | 1 | 1 0 | 1 | 1 | 1 | 1 + 1 | 1 + 1 | 1 + -1 | 1 | 1 + | 4 | 1 1 | 1 1 | 1 1 | 1 0 | 1 | 1 - 0 | 1 - 1 | 1 0 | 1 | 1 - 1 | 1 | 1 + 1 | 1 + 0 | 1 | 1 + 0 | 1 0 | 1 | 1 + 1 | 1 | 1 | 1 0 | 1 0 | 1 - 1 | 1 - | 1 | 1 (73 rows) select a,count(*) from orca.m group by grouping sets ((a), (a,b)); a | count ----+------- - 11 | 1 - 9 | 1 - 31 | 1 - 28 | 1 - 10 | 1 + 0 | 1 + 13 | 1 + 34 | 1 + 33 | 1 + 19 | 1 + 20 | 1 + 29 | 1 + 25 | 1 + 16 | 1 + 15 | 1 + 1 | 1 18 | 1 - 21 | 1 - 8 | 1 - 32 | 1 + 6 | 1 25 | 1 - 29 | 1 - 0 | 1 18 | 1 + 22 | 1 + 29 | 1 + 8 | 1 + 19 | 1 + 32 | 1 + 23 | 1 + 4 | 1 + 24 | 1 2 | 1 - 14 | 1 - 7 | 1 - 30 | 1 - 27 | 1 + 12 | 1 5 | 1 - 3 | 1 - 11 | 1 - 0 | 1 - 26 | 1 4 | 1 - 22 | 1 - 34 | 1 - 1 | 1 1 | 1 + 33 | 1 + 26 | 1 28 | 1 - 19 | 1 - 10 | 1 + 27 | 1 + 17 | 1 + 34 | 1 23 | 1 1 | 1 - 15 | 1 + 12 | 1 + 21 | 1 + 7 | 1 + 3 | 1 + 31 | 1 + 10 | 1 + 32 | 1 + 7 | 1 8 | 1 + 0 | 1 30 | 1 - 21 | 1 - 25 | 1 - 33 | 1 20 | 1 - 12 | 1 - 24 | 1 - 1 | 4 - 15 | 1 - 6 | 1 - 7 | 1 - 29 | 1 - 1 | 1 - 5 | 1 - 26 | 1 - 4 | 1 - 33 | 1 - 22 | 1 - 23 | 1 13 | 1 - 12 | 1 24 | 1 + 1 | 1 + 1 | 4 16 | 1 + 31 | 1 + 14 | 1 + 26 | 1 + 5 | 1 + 9 | 1 + 11 | 1 6 | 1 14 | 1 - 20 | 1 - 2 | 1 - 16 | 1 - 31 | 1 - 27 | 1 - 13 | 1 + 28 | 1 + 15 | 1 + 11 | 1 + 21 | 1 9 | 1 + 10 | 1 + 30 | 1 + 27 | 1 + 22 | 1 17 | 1 - 32 | 1 - 17 | 1 - 34 | 1 3 | 1 - 19 | 1 + 2 | 1 (73 rows) select a,count(*) from orca.m group by grouping sets ((a), (b)); a | count ----+------- - 11 | 1 - 9 | 1 - 31 | 1 - 8 | 1 - | 19 - 0 | 1 + 34 | 1 + 20 | 1 + 29 | 1 + 16 | 1 + 25 | 1 + 15 | 1 18 | 1 - 2 | 1 - 30 | 1 - 27 | 1 + 19 | 1 + | 1 + 24 | 1 + 12 | 1 5 | 1 4 | 1 + 33 | 1 26 | 1 - 34 | 1 - | 1 28 | 1 - 10 | 1 + 17 | 1 + | 19 23 | 1 - 15 | 1 - | 1 - 25 | 1 21 | 1 - 33 | 1 - 20 | 1 - 24 | 1 - 1 | 4 - | 17 - 6 | 1 - 29 | 1 7 | 1 - 22 | 1 + 3 | 1 + 32 | 1 + | 17 + 8 | 1 + 0 | 1 + 30 | 1 13 | 1 - 12 | 1 + 1 | 4 + 31 | 1 + 9 | 1 + 6 | 1 14 | 1 - 16 | 1 - 17 | 1 - 32 | 1 - 3 | 1 - 19 | 1 + 11 | 1 + 10 | 1 + | 1 + 27 | 1 + 22 | 1 + 2 | 1 (39 rows) select a,b,count(*) from orca.m group by rollup(a, b); a | b | count ----+----+------- - 22 | 1 | 1 + 0 | 1 | 1 + 13 | 0 | 1 34 | | 1 - 1 | -1 | 1 - 1 | 2 | 1 - 28 | | 1 + 33 | 0 | 1 19 | 0 | 1 - 10 | | 1 - 23 | | 1 - 1 | 1 | 1 - 15 | | 1 - 8 | 1 | 1 - 30 | 1 | 1 - 21 | | 1 - 25 | | 1 - 33 | | 1 20 | | 1 - 12 | 1 | 1 - 24 | | 1 - 1 | | 4 - 15 | 0 | 1 - 6 | | 1 - 7 | | 1 29 | | 1 + 16 | | 1 + 25 | | 1 + 15 | | 1 1 | 0 | 1 - 5 | 0 | 1 - 26 | 1 | 1 - 4 | 1 | 1 - 33 | 0 | 1 - 22 | | 1 - 23 | 0 | 1 - 13 | | 1 - 12 | | 1 - 24 | 1 | 1 - 16 | 1 | 1 + 18 | 1 | 1 6 | 1 | 1 - 14 | | 1 - 20 | 1 | 1 + | | 38 + 25 | 0 | 1 + 22 | 1 | 1 + 18 | | 1 + 19 | | 1 + 29 | 0 | 1 + 8 | 1 | 1 + 32 | 1 | 1 + 23 | 0 | 1 + 4 | 1 | 1 + 24 | | 1 2 | 1 | 1 - 16 | | 1 - 31 | 0 | 1 + 12 | | 1 + 5 | | 1 + 4 | | 1 + 1 | 1 | 1 + 33 | | 1 + 26 | | 1 + 28 | | 1 27 | 0 | 1 - 13 | 0 | 1 - 9 | 0 | 1 17 | | 1 - 32 | | 1 - 17 | 0 | 1 - 3 | | 1 34 | 1 | 1 - 19 | | 1 - 11 | | 1 - 9 | | 1 + 23 | | 1 + 1 | 2 | 1 + 12 | 1 | 1 + 21 | | 1 + 7 | | 1 + 3 | | 1 + 31 | 0 | 1 + 10 | 1 | 1 + 32 | | 1 + 7 | 0 | 1 + 8 | | 1 + 0 | | 1 + 30 | | 1 + 20 | 1 | 1 + 13 | | 1 + 24 | 1 | 1 + 1 | -1 | 1 + 1 | | 4 + 16 | 1 | 1 31 | | 1 + 14 | 1 | 1 + 26 | 1 | 1 + 5 | 0 | 1 + 9 | | 1 + 11 | 0 | 1 + 6 | | 1 + 14 | | 1 28 | 1 | 1 - 10 | 1 | 1 - 18 | 1 | 1 + 15 | 0 | 1 + 11 | | 1 21 | 0 | 1 - 8 | | 1 - 32 | 1 | 1 - 25 | 0 | 1 - 29 | 0 | 1 - 0 | | 1 - 18 | | 1 - 2 | | 1 - 14 | 1 | 1 - 7 | 0 | 1 - 30 | | 1 + 9 | 0 | 1 + 10 | | 1 + 30 | 1 | 1 27 | | 1 - 5 | | 1 + 22 | | 1 + 17 | 0 | 1 3 | 0 | 1 - | | 38 - 11 | 0 | 1 - 0 | 1 | 1 - 26 | | 1 - 4 | | 1 + 2 | | 1 (74 rows) select a,b,count(*) from orca.m group by rollup((a),(a,b)) order by 1,2,3; @@ -4172,54 +4178,54 @@ select count(*) from orca.m group by (); select a, count(*) from orca.r group by (), a; a | count ----+------- - 14 | 1 - 16 | 1 - 17 | 1 - 1 | 1 - 15 | 1 - 2 | 1 - 13 | 1 - 7 | 1 19 | 1 18 | 1 - | 1 - 6 | 1 + 7 | 1 + 2 | 1 4 | 1 - 20 | 1 + 8 | 1 + 16 | 1 + | 1 3 | 1 - 5 | 1 - 9 | 1 + 20 | 1 + 1 | 1 12 | 1 - 8 | 1 + 15 | 1 + 5 | 1 + 13 | 1 11 | 1 10 | 1 + 17 | 1 + 6 | 1 + 14 | 1 + 9 | 1 (21 rows) select a, count(*) from orca.r group by grouping sets ((),(a)); a | count ----+------- - 14 | 1 - 5 | 1 + 3 | 1 9 | 1 + 6 | 1 10 | 1 - 19 | 1 - 18 | 1 - 1 | 1 - 20 | 1 + 5 | 1 + 16 | 1 | 21 + 14 | 1 + 20 | 1 7 | 1 - 16 | 1 + 18 | 1 + 13 | 1 15 | 1 - 11 | 1 - 2 | 1 - 6 | 1 - | 1 17 | 1 - 4 | 1 8 | 1 - 3 | 1 + 1 | 1 + | 1 + 11 | 1 12 | 1 - 13 | 1 + 19 | 1 + 4 | 1 + 2 | 1 (22 rows) select a, b, count(*) c from orca.r group by grouping sets ((),(a), (a,b)) order by b,a,c; @@ -4327,27 +4333,27 @@ select 1 from orca.r group by (); select a,1 from orca.r group by rollup(a); a | ?column? ----+---------- - 1 | 1 + 3 | 1 5 | 1 + 6 | 1 9 | 1 10 | 1 - 14 | 1 - 18 | 1 - 19 | 1 - 2 | 1 - 6 | 1 - 7 | 1 - 11 | 1 - 15 | 1 16 | 1 - 20 | 1 | 1 - 3 | 1 - 4 | 1 + 7 | 1 8 | 1 - 12 | 1 13 | 1 + 14 | 1 + 15 | 1 17 | 1 + 18 | 1 + 20 | 1 + 1 | 1 + 2 | 1 + 4 | 1 + 11 | 1 + 12 | 1 + 19 | 1 | 1 (22 rows) @@ -4355,205 +4361,205 @@ select a,1 from orca.r group by rollup(a); select array[array[a,b]], array[b] from orca.r; array | array ------------+------- - {{1,1}} | {1} {{2,2}} | {2} - {{13,1}} | {1} - {{14,2}} | {2} - {{15,0}} | {0} - {{16,1}} | {1} - {{17,2}} | {2} {{3,0}} | {0} {{4,1}} | {1} - {{5,2}} | {2} - {{6,0}} | {0} {{7,1}} | {1} + {{8,2}} | {2} + {{16,1}} | {1} {{18,0}} | {0} {{19,1}} | {1} - {{20,2}} | {2} {{NULL,1}} | {1} - {{8,2}} | {2} + {{1,1}} | {1} + {{12,0}} | {0} + {{15,0}} | {0} + {{20,2}} | {2} + {{5,2}} | {2} + {{6,0}} | {0} {{9,0}} | {0} {{10,1}} | {1} {{11,2}} | {2} - {{12,0}} | {0} + {{13,1}} | {1} + {{14,2}} | {2} + {{17,2}} | {2} (21 rows) -- setops select a, b from orca.m union select b,a from orca.m; a | b ----+---- - 0 | 1 + 22 | 1 + 1 | 26 + 1 | 34 + -1 | 1 + 32 | 1 + 1 | 16 + 4 | 1 + 13 | 0 0 | 13 - 0 | 15 - 0 | 27 - 0 | 29 + 29 | 0 + 2 | 1 + 0 | 19 0 | 31 - 1 | 8 - 1 | 10 - 1 | 12 - 1 | 24 - 1 | 26 + 1 | 14 + 19 | 0 + 0 | 29 + 1 | 22 + 0 | 1 + 33 | 0 + 23 | 0 + 8 | 1 + 6 | 1 1 | 32 - 3 | 0 - 7 | 0 - 10 | 1 - 11 | 0 - 14 | 1 + 1 | 18 + 1 | 0 18 | 1 - 21 | 0 + 0 | 27 25 | 0 - 28 | 1 - 29 | 0 - 32 | 1 - 0 | 3 - 0 | 5 - 0 | 17 - 0 | 19 - 0 | 21 - 0 | 33 - 1 | -1 - 1 | 0 - 1 | 1 1 | 2 - 1 | 14 - 1 | 16 - 1 | 28 + 1 | 12 + 34 | 1 + 12 | 1 + 0 | 9 + 24 | 1 + 1 | 10 + 1 | 1 + 16 | 1 + 1 | 20 + 20 | 1 + 0 | 25 + 27 | 0 + 0 | 21 1 | 30 - 1 | 34 - 4 | 1 + 31 | 0 + 0 | 5 + 10 | 1 + 1 | 6 + 7 | 0 + 1 | -1 + 11 | 0 + 1 | 4 + 3 | 0 + 0 | 17 5 | 0 - 8 | 1 - 12 | 1 + 0 | 7 15 | 0 - 19 | 0 - 22 | 1 - 23 | 0 - 26 | 1 + 1 | 28 + 1 | 8 30 | 1 - 33 | 0 - -1 | 1 - 0 | 7 - 0 | 9 0 | 11 + 0 | 3 + 21 | 0 + 0 | 15 + 14 | 1 + 26 | 1 + 1 | 24 0 | 23 - 0 | 25 - 1 | 4 - 1 | 6 - 1 | 18 - 1 | 20 - 1 | 22 - 2 | 1 - 6 | 1 9 | 0 - 13 | 0 - 16 | 1 17 | 0 - 20 | 1 - 24 | 1 - 27 | 0 - 31 | 0 - 34 | 1 + 0 | 33 + 28 | 1 (71 rows) SELECT a from orca.m UNION ALL select b from orca.m UNION ALL select a+b from orca.m group by 1; a ---- - 12 - 14 - 19 - 25 - 28 + 1 + 2 + 6 + 7 + 8 + 10 + 12 + 13 + 15 + 16 + 21 + 22 + 26 + 27 29 - 33 - 34 1 + 0 1 1 0 - 0 1 - 0 - 0 1 - -1 - 35 - 31 - 17 1 - 15 - 33 - 2 0 - 13 - 29 0 1 - 3 - 4 - 8 - 9 - 15 - 23 - 30 + 0 1 1 0 0 - 1 + 2 + 19 + 27 + 2 + 7 + 29 + 3 + 0 + 5 + 11 + 14 + 17 + 18 + 25 + 34 1 0 0 + 1 0 1 + 0 1 - 7 - 19 - 21 - 3 - 5 - 2 5 - 6 - 7 - 10 - 11 13 - 16 + 33 + 11 17 - 18 - 20 21 - 22 + 25 + 9 + 3 + 4 + 9 + 19 + 20 + 23 24 - 26 - 27 + 28 + 30 31 32 + 33 1 1 0 1 0 - 1 - 0 - 0 - 1 0 1 - 1 0 1 1 1 0 + 1 0 + -1 1 - 2 - 9 - 27 - 11 23 - 25 + 35 + 1 + 31 + 0 + 15 (96 rows) drop table if exists orca.foo; @@ -4571,421 +4577,421 @@ insert into orca.bar select i, i%3, i%2 from generate_series(1,30)i; SELECT distinct a, b from orca.foo; a | b ----+--- - 16 | 0 + 23 | 1 + 12 | 0 + 1 | 1 + 38 | 0 + 35 | 1 + 20 | 0 + 40 | 0 + 26 | 0 15 | 1 - 33 | 1 - 13 | 1 + 31 | 1 + 36 | 0 30 | 0 - 17 | 1 + 27 | 1 + 3 | 1 + 22 | 0 + 18 | 0 + 7 | 1 34 | 0 - 36 | 0 - 35 | 1 - 31 | 1 - 37 | 1 29 | 1 - 28 | 0 - 2 | 0 - 1 | 1 - 14 | 0 - 5 | 1 - 6 | 0 - 7 | 1 4 | 0 - 22 | 0 - 18 | 0 - 21 | 1 + 24 | 0 + 2 | 0 19 | 1 - 38 | 0 - 40 | 0 39 | 1 - 20 | 0 - 3 | 1 - 27 | 1 - 24 | 0 - 12 | 0 + 16 | 0 + 37 | 1 8 | 0 + 28 | 0 + 5 | 1 + 6 | 0 + 17 | 1 + 13 | 1 + 32 | 0 + 21 | 1 25 | 1 - 23 | 1 10 | 0 + 33 | 1 + 14 | 0 11 | 1 - 32 | 0 - 26 | 0 9 | 1 (40 rows) SELECT distinct foo.a, bar.b from orca.foo, orca.bar where foo.b = bar.a; a | b ----+--- - 5 | 1 - 33 | 1 - 19 | 1 - 37 | 1 23 | 1 - 1 | 1 + 3 | 1 + 33 | 1 + 11 | 1 + 31 | 1 9 | 1 - 15 | 1 + 5 | 1 + 27 | 1 7 | 1 35 | 1 - 39 | 1 - 25 | 1 - 29 | 1 - 11 | 1 - 27 | 1 - 13 | 1 - 17 | 1 21 | 1 - 31 | 1 - 3 | 1 + 19 | 1 + 15 | 1 + 17 | 1 + 13 | 1 + 29 | 1 + 1 | 1 + 25 | 1 + 39 | 1 + 37 | 1 (20 rows) SELECT distinct a, b from orca.foo; a | b ----+--- - 16 | 0 - 15 | 1 - 33 | 1 - 13 | 1 - 30 | 0 - 17 | 1 - 34 | 0 - 36 | 0 - 35 | 1 - 31 | 1 - 37 | 1 - 29 | 1 28 | 0 - 2 | 0 - 1 | 1 - 14 | 0 5 | 1 6 | 0 - 7 | 1 - 4 | 0 + 17 | 1 + 13 | 1 + 32 | 0 + 21 | 1 + 25 | 1 + 10 | 0 + 33 | 1 + 14 | 0 + 11 | 1 + 9 | 1 + 27 | 1 + 3 | 1 22 | 0 18 | 0 - 21 | 1 + 7 | 1 + 34 | 0 + 29 | 1 + 4 | 0 + 24 | 0 + 2 | 0 19 | 1 - 38 | 0 - 40 | 0 39 | 1 - 20 | 0 - 3 | 1 - 27 | 1 - 24 | 0 - 12 | 0 + 16 | 0 + 37 | 1 8 | 0 - 25 | 1 23 | 1 - 10 | 0 - 11 | 1 - 32 | 0 + 12 | 0 + 1 | 1 + 38 | 0 + 35 | 1 + 20 | 0 + 40 | 0 26 | 0 - 9 | 1 + 15 | 1 + 31 | 1 + 36 | 0 + 30 | 0 (40 rows) -SELECT distinct a, count(*) from orca.foo group by a; - a | count -----+------- - 1 | 1 - 2 | 1 - 3 | 1 - 4 | 1 - 5 | 1 - 6 | 1 - 7 | 1 - 8 | 1 - 9 | 1 - 10 | 1 - 11 | 1 +SELECT distinct a, count(*) from orca.foo group by a; + a | count +----+------- + 34 | 1 12 | 1 + 24 | 1 + 17 | 1 13 | 1 - 14 | 1 - 15 | 1 + 29 | 1 + 1 | 1 16 | 1 - 17 | 1 - 18 | 1 - 19 | 1 20 | 1 - 21 | 1 - 22 | 1 - 23 | 1 - 24 | 1 25 | 1 - 26 | 1 + 36 | 1 + 39 | 1 + 10 | 1 + 37 | 1 + 22 | 1 + 5 | 1 27 | 1 - 28 | 1 - 29 | 1 - 30 | 1 - 31 | 1 32 | 1 - 33 | 1 - 34 | 1 + 4 | 1 + 7 | 1 35 | 1 - 36 | 1 - 37 | 1 - 38 | 1 - 39 | 1 + 21 | 1 40 | 1 + 2 | 1 + 19 | 1 + 15 | 1 + 8 | 1 + 6 | 1 + 18 | 1 + 38 | 1 + 23 | 1 + 3 | 1 + 30 | 1 + 14 | 1 + 26 | 1 + 33 | 1 + 11 | 1 + 31 | 1 + 9 | 1 + 28 | 1 (40 rows) SELECT distinct foo.a, bar.b, sum(bar.c+foo.c) from orca.foo, orca.bar where foo.b = bar.a group by foo.a, bar.b; a | b | sum ----+---+----- - 1 | 1 | 2 - 3 | 1 | 4 - 5 | 1 | 2 - 7 | 1 | 4 - 9 | 1 | 2 + 15 | 1 | 4 11 | 1 | 4 + 5 | 1 | 2 + 33 | 1 | 2 + 31 | 1 | 4 + 37 | 1 | 2 + 29 | 1 | 2 13 | 1 | 2 - 15 | 1 | 4 - 17 | 1 | 2 - 19 | 1 | 4 21 | 1 | 2 - 23 | 1 | 4 + 3 | 1 | 4 + 17 | 1 | 2 25 | 1 | 2 + 7 | 1 | 4 27 | 1 | 4 - 29 | 1 | 2 - 31 | 1 | 4 - 33 | 1 | 2 - 35 | 1 | 4 - 37 | 1 | 2 + 9 | 1 | 2 39 | 1 | 4 + 1 | 1 | 2 + 35 | 1 | 4 + 19 | 1 | 4 + 23 | 1 | 4 (20 rows) SELECT distinct a, count(*) from orca.foo group by a; a | count ----+------- - 1 | 1 - 2 | 1 - 3 | 1 - 4 | 1 + 22 | 1 5 | 1 - 6 | 1 + 27 | 1 + 32 | 1 + 4 | 1 7 | 1 + 35 | 1 + 21 | 1 + 40 | 1 + 2 | 1 + 19 | 1 + 15 | 1 8 | 1 - 9 | 1 - 10 | 1 - 11 | 1 + 6 | 1 + 38 | 1 + 18 | 1 + 34 | 1 12 | 1 - 13 | 1 - 14 | 1 - 15 | 1 - 16 | 1 + 24 | 1 17 | 1 - 18 | 1 - 19 | 1 + 13 | 1 + 1 | 1 + 29 | 1 20 | 1 - 21 | 1 - 22 | 1 - 23 | 1 - 24 | 1 + 16 | 1 25 | 1 - 26 | 1 - 27 | 1 - 28 | 1 - 29 | 1 - 30 | 1 - 31 | 1 - 32 | 1 - 33 | 1 - 34 | 1 - 35 | 1 36 | 1 - 37 | 1 - 38 | 1 39 | 1 - 40 | 1 + 10 | 1 + 37 | 1 + 23 | 1 + 3 | 1 + 30 | 1 + 14 | 1 + 26 | 1 + 33 | 1 + 11 | 1 + 31 | 1 + 9 | 1 + 28 | 1 (40 rows) SELECT distinct foo.a, bar.b from orca.foo, orca.bar where foo.b = bar.a; a | b ----+--- - 15 | 1 + 5 | 1 + 27 | 1 7 | 1 35 | 1 - 39 | 1 - 25 | 1 - 29 | 1 - 11 | 1 - 5 | 1 - 33 | 1 + 21 | 1 19 | 1 + 15 | 1 + 17 | 1 + 13 | 1 + 29 | 1 + 1 | 1 + 25 | 1 + 39 | 1 37 | 1 23 | 1 - 1 | 1 - 9 | 1 - 27 | 1 - 13 | 1 - 17 | 1 - 21 | 1 - 31 | 1 3 | 1 + 33 | 1 + 11 | 1 + 31 | 1 + 9 | 1 (20 rows) SELECT distinct foo.a, bar.b, sum(bar.c+foo.c) from orca.foo, orca.bar where foo.b = bar.a group by foo.a, bar.b; a | b | sum ----+---+----- - 1 | 1 | 2 - 3 | 1 | 4 - 5 | 1 | 2 - 7 | 1 | 4 9 | 1 | 2 - 11 | 1 | 4 - 13 | 1 | 2 - 15 | 1 | 4 - 17 | 1 | 2 + 39 | 1 | 4 + 1 | 1 | 2 + 35 | 1 | 4 19 | 1 | 4 - 21 | 1 | 2 23 | 1 | 4 + 29 | 1 | 2 + 13 | 1 | 2 + 21 | 1 | 2 + 3 | 1 | 4 + 17 | 1 | 2 25 | 1 | 2 + 7 | 1 | 4 27 | 1 | 4 - 29 | 1 | 2 - 31 | 1 | 4 + 15 | 1 | 4 + 11 | 1 | 4 + 5 | 1 | 2 33 | 1 | 2 - 35 | 1 | 4 + 31 | 1 | 4 37 | 1 | 2 - 39 | 1 | 4 (20 rows) SELECT distinct a, b from orca.foo; a | b ----+--- - 16 | 0 - 15 | 1 - 33 | 1 - 13 | 1 - 30 | 0 - 17 | 1 + 27 | 1 + 3 | 1 + 22 | 0 + 18 | 0 + 7 | 1 34 | 0 - 36 | 0 - 35 | 1 - 31 | 1 - 37 | 1 29 | 1 - 28 | 0 + 4 | 0 + 24 | 0 2 | 0 + 19 | 1 + 39 | 1 + 16 | 0 + 37 | 1 + 8 | 0 + 23 | 1 + 12 | 0 1 | 1 - 14 | 0 + 38 | 0 + 35 | 1 + 20 | 0 + 40 | 0 + 26 | 0 + 15 | 1 + 31 | 1 + 36 | 0 + 30 | 0 + 28 | 0 5 | 1 6 | 0 - 7 | 1 - 4 | 0 - 22 | 0 - 18 | 0 + 17 | 1 + 13 | 1 + 32 | 0 21 | 1 - 19 | 1 - 38 | 0 - 40 | 0 - 39 | 1 - 20 | 0 - 3 | 1 - 27 | 1 - 24 | 0 - 12 | 0 - 8 | 0 25 | 1 - 23 | 1 10 | 0 + 33 | 1 + 14 | 0 11 | 1 - 32 | 0 - 26 | 0 9 | 1 (40 rows) SELECT distinct a, count(*) from orca.foo group by a; a | count ----+------- - 1 | 1 - 2 | 1 - 3 | 1 - 4 | 1 + 22 | 1 5 | 1 - 6 | 1 + 27 | 1 + 32 | 1 + 4 | 1 7 | 1 - 8 | 1 - 9 | 1 - 10 | 1 - 11 | 1 - 12 | 1 - 13 | 1 - 14 | 1 + 35 | 1 + 21 | 1 + 40 | 1 + 2 | 1 + 19 | 1 15 | 1 - 16 | 1 - 17 | 1 + 8 | 1 + 6 | 1 + 38 | 1 18 | 1 - 19 | 1 - 20 | 1 - 21 | 1 - 22 | 1 23 | 1 - 24 | 1 - 25 | 1 - 26 | 1 - 27 | 1 - 28 | 1 - 29 | 1 + 3 | 1 30 | 1 - 31 | 1 - 32 | 1 + 14 | 1 + 26 | 1 33 | 1 + 11 | 1 + 31 | 1 + 9 | 1 + 28 | 1 34 | 1 - 35 | 1 + 12 | 1 + 24 | 1 + 17 | 1 + 13 | 1 + 1 | 1 + 29 | 1 + 20 | 1 + 16 | 1 + 25 | 1 36 | 1 - 37 | 1 - 38 | 1 39 | 1 - 40 | 1 + 10 | 1 + 37 | 1 (40 rows) SELECT distinct foo.a, bar.b from orca.foo, orca.bar where foo.b = bar.a; a | b ----+--- - 15 | 1 + 5 | 1 + 27 | 1 7 | 1 35 | 1 - 39 | 1 - 25 | 1 - 29 | 1 - 11 | 1 - 5 | 1 - 33 | 1 + 21 | 1 19 | 1 + 15 | 1 + 17 | 1 + 13 | 1 + 1 | 1 + 29 | 1 + 25 | 1 + 39 | 1 37 | 1 23 | 1 - 1 | 1 - 9 | 1 - 27 | 1 - 13 | 1 - 17 | 1 - 21 | 1 - 31 | 1 3 | 1 + 33 | 1 + 11 | 1 + 31 | 1 + 9 | 1 (20 rows) SELECT distinct foo.a, bar.b, sum(bar.c+foo.c) from orca.foo, orca.bar where foo.b = bar.a group by foo.a, bar.b; a | b | sum ----+---+----- - 1 | 1 | 2 - 3 | 1 | 4 - 5 | 1 | 2 - 7 | 1 | 4 - 9 | 1 | 2 + 15 | 1 | 4 11 | 1 | 4 + 5 | 1 | 2 + 33 | 1 | 2 + 31 | 1 | 4 + 37 | 1 | 2 + 29 | 1 | 2 13 | 1 | 2 - 15 | 1 | 4 - 17 | 1 | 2 - 19 | 1 | 4 21 | 1 | 2 - 23 | 1 | 4 - 25 | 1 | 2 + 3 | 1 | 4 + 17 | 1 | 2 + 7 | 1 | 4 27 | 1 | 4 - 29 | 1 | 2 - 31 | 1 | 4 - 33 | 1 | 2 - 35 | 1 | 4 - 37 | 1 | 2 + 25 | 1 | 2 + 9 | 1 | 2 39 | 1 | 4 + 1 | 1 | 2 + 35 | 1 | 4 + 19 | 1 | 4 + 23 | 1 | 4 (20 rows) -- window operations @@ -6585,12 +6591,12 @@ select (select rank() over() from orca_w3 where a = orca_w1.a) as one, row_numbe | 1 | 2 | 3 - 1 | 1 - 1 | 2 - 1 | 3 | 1 | 2 | 3 + 1 | 1 + 1 | 2 + 1 | 3 (9 rows) -- window function in IN clause @@ -6619,9 +6625,9 @@ select (select rank() over(partition by orca_w2.a) from orca_w3 where a = orca_w select (select a+1 from (select a from orca_w2 where orca_w1.a=orca_w2.a) sq(a)) as one, row_number() over(partition by orca_w1.a) as two from orca_w1; one | two -----+----- - | 1 3 | 1 4 | 1 + | 1 (3 rows) -- correlated subquery in target list, mismatching varattnos @@ -6708,46 +6714,46 @@ select rank() over(partition by a, case when b = 0 then a+b end order by b asc) select foo.d from orca.foo full join orca.bar on (foo.d = bar.a) group by d; d ---- - 30 - 35 - 14 + 24 + 19 + 18 37 - 16 - 28 - 31 - 1 - 17 - 15 - 36 + 22 + 39 + 27 34 - 33 2 - 0 - 13 - 29 7 - 19 - 39 - 18 - 6 4 - 21 - 20 - 38 + 29 + 8 + 16 3 - 5 - 22 - 24 - 9 + 20 + 23 + 35 + 30 + 1 + 31 + 0 12 - 8 + 38 + 15 + 36 26 - 27 - 32 + 5 + 13 11 - 23 - 25 10 + 33 + 17 + 6 + 21 + 28 + 25 + 14 + 9 + 32 (40 rows) select 1 as v from orca.foo full join orca.bar on (foo.d = bar.a) group by d; @@ -6833,118 +6839,118 @@ insert into orca.rcte select i, i%2, i%3 from generate_series(1,40)i; with x as (select * from orca.rcte where a < 10) select * from x x1, x x2; a | b | c | a | b | c ---+---+---+---+---+--- - 8 | 0 | 2 | 8 | 0 | 2 - 8 | 0 | 2 | 9 | 1 | 0 - 8 | 0 | 2 | 3 | 1 | 0 - 8 | 0 | 2 | 4 | 0 | 1 - 8 | 0 | 2 | 5 | 1 | 2 - 8 | 0 | 2 | 6 | 0 | 0 - 8 | 0 | 2 | 7 | 1 | 1 - 8 | 0 | 2 | 1 | 1 | 1 - 8 | 0 | 2 | 2 | 0 | 2 - 9 | 1 | 0 | 8 | 0 | 2 - 9 | 1 | 0 | 9 | 1 | 0 - 9 | 1 | 0 | 3 | 1 | 0 - 9 | 1 | 0 | 4 | 0 | 1 - 9 | 1 | 0 | 5 | 1 | 2 - 9 | 1 | 0 | 6 | 0 | 0 - 9 | 1 | 0 | 7 | 1 | 1 - 9 | 1 | 0 | 1 | 1 | 1 - 9 | 1 | 0 | 2 | 0 | 2 - 1 | 1 | 1 | 8 | 0 | 2 - 1 | 1 | 1 | 9 | 1 | 0 - 1 | 1 | 1 | 1 | 1 | 1 - 1 | 1 | 1 | 2 | 0 | 2 - 1 | 1 | 1 | 3 | 1 | 0 - 1 | 1 | 1 | 4 | 0 | 1 - 1 | 1 | 1 | 5 | 1 | 2 - 1 | 1 | 1 | 6 | 0 | 0 - 1 | 1 | 1 | 7 | 1 | 1 - 2 | 0 | 2 | 8 | 0 | 2 + 2 | 0 | 2 | 5 | 1 | 2 + 2 | 0 | 2 | 6 | 0 | 0 2 | 0 | 2 | 9 | 1 |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 0 | 0 | 2 | 0 | 2 - 7 | 1 | 1 | 8 | 0 | 2 - 7 | 1 | 1 | 9 | 1 | 0 - 7 | 1 | 1 | 3 | 1 | 0 - 7 | 1 | 1 | 4 | 0 | 1 - 7 | 1 | 1 | 5 | 1 | 2 - 7 | 1 | 1 | 6 | 0 | 0 - 7 | 1 | 1 | 7 | 1 | 1 - 7 | 1 | 1 | 1 | 1 | 1 - 7 | 1 | 1 | 2 | 0 | 2 + 9 | 1 | 0 | 2 | 0 | 2 + 9 | 1 | 0 | 3 | 1 | 0 + 9 | 1 | 0 | 4 | 0 | 1 + 9 | 1 | 0 | 7 | 1 | 1 + 9 | 1 | 0 | 8 | 0 | 2 + 9 | 1 | 0 | 5 | 1 | 2 + 9 | 1 | 0 | 6 | 0 | 0 + 9 | 1 | 0 | 9 | 1 | 0 + 9 | 1 | 0 | 1 | 1 | 1 (81 rows) with x as (select * from orca.rcte where a < 10) select * from x x1, x x2 where x2.a = x1.b; a | b | c | a | b | c ---+---+---+---+---+--- - 1 | 1 | 1 | 1 | 1 | 1 3 | 1 | 0 | 1 | 1 | 1 - 5 | 1 | 2 | 1 | 1 | 1 7 | 1 | 1 | 1 | 1 | 1 + 1 | 1 | 1 | 1 | 1 | 1 + 5 | 1 | 2 | 1 | 1 | 1 9 | 1 | 0 | 1 | 1 | 1 (5 rows) with x as (select * from orca.rcte where a < 10) select a from x union all select b from x; a --- - 3 - 4 5 6 - 7 + 9 1 0 1 - 0 1 + 1 + 2 + 3 + 4 + 7 8 - 9 0 1 - 1 - 2 + 0 1 0 (18 rows) @@ -6953,10 +6959,10 @@ with x as (select * from orca.rcte where a < 10) select * from x x1 where x1.b = a | b | c ---+---+--- 1 | 1 | 1 - 3 | 1 | 0 5 | 1 | 2 - 7 | 1 | 1 9 | 1 | 0 + 3 | 1 | 0 + 7 | 1 | 1 (5 rows) with x as (select * from orca.rcte where a < 10) select * from x x1 where x1.b = all (select x2.a from x x2 group by x2.a); @@ -6967,39 +6973,39 @@ with x as (select * from orca.rcte where a < 10) select * from x x1 where x1.b = with x as (select * from orca.rcte where a < 10) select * from x x1, x x2, x x3 where x2.a = x1.b and x3.b = x2.b ; a | b | c | a | b | c | a | b | c ---+---+---+---+---+---+---+---+--- - 9 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 - 7 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 - 5 | 1 | 2 | 1 | 1 | 1 | 1 | 1 | 1 + 3 | 1 | 0 | 1 | 1 | 1 | 9 | 1 | 0 + 3 | 1 | 0 | 1 | 1 | 1 | 5 | 1 | 2 3 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 - 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 - 9 | 1 | 0 | 1 | 1 | 1 | 3 | 1 | 0 - 7 | 1 | 1 | 1 | 1 | 1 | 3 | 1 | 0 - 5 | 1 | 2 | 1 | 1 | 1 | 3 | 1 | 0 + 3 | 1 | 0 | 1 | 1 | 1 | 7 | 1 | 1 3 | 1 | 0 | 1 | 1 | 1 | 3 | 1 | 0 - 1 | 1 | 1 | 1 | 1 | 1 | 3 | 1 | 0 - 9 | 1 | 0 | 1 | 1 | 1 | 5 | 1 | 2 + 7 | 1 | 1 | 1 | 1 | 1 | 9 | 1 | 0 7 | 1 | 1 | 1 | 1 | 1 | 5 | 1 | 2 - 5 | 1 | 2 | 1 | 1 | 1 | 5 | 1 | 2 - 3 | 1 | 0 | 1 | 1 | 1 | 5 | 1 | 2 - 1 | 1 | 1 | 1 | 1 | 1 | 5 | 1 | 2 - 9 | 1 | 0 | 1 | 1 | 1 | 7 | 1 | 1 + 7 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 7 | 1 | 1 | 1 | 1 | 1 | 7 | 1 | 1 + 7 | 1 | 1 | 1 | 1 | 1 | 3 | 1 | 0 + 5 | 1 | 2 | 1 | 1 | 1 | 9 | 1 | 0 + 5 | 1 | 2 | 1 | 1 | 1 | 5 | 1 | 2 + 5 | 1 | 2 | 1 | 1 | 1 | 1 | 1 | 1 5 | 1 | 2 | 1 | 1 | 1 | 7 | 1 | 1 - 3 | 1 | 0 | 1 | 1 | 1 | 7 | 1 | 1 - 1 | 1 | 1 | 1 | 1 | 1 | 7 | 1 | 1 + 5 | 1 | 2 | 1 | 1 | 1 | 3 | 1 | 0 9 | 1 | 0 | 1 | 1 | 1 | 9 | 1 | 0 - 7 | 1 | 1 | 1 | 1 | 1 | 9 | 1 | 0 - 5 | 1 | 2 | 1 | 1 | 1 | 9 | 1 | 0 - 3 | 1 | 0 | 1 | 1 | 1 | 9 | 1 | 0 + 9 | 1 | 0 | 1 | 1 | 1 | 5 | 1 | 2 + 9 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 + 9 | 1 | 0 | 1 | 1 | 1 | 7 | 1 | 1 + 9 | 1 | 0 | 1 | 1 | 1 | 3 | 1 | 0 1 | 1 | 1 | 1 | 1 | 1 | 9 | 1 | 0 + 1 | 1 | 1 | 1 | 1 | 1 | 5 | 1 | 2 + 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 + 1 | 1 | 1 | 1 | 1 | 1 | 7 | 1 | 1 + 1 | 1 | 1 | 1 | 1 | 1 | 3 | 1 | 0 (25 rows) with x as (select * from orca.rcte where a < 10) select * from x x2 where x2.b < (select avg(b) from x x1); a | b | c ---+---+--- + 6 | 0 | 0 2 | 0 | 2 4 | 0 | 1 - 6 | 0 | 0 8 | 0 | 2 (4 rows) @@ -7236,695 +7242,695 @@ with x as (select r.a from orca.r, orca.s where r.a < 10 and s.d < 10 and r.a = with x as (select r.a from orca.r, orca.s where r.a < 10 and s.c < 10 and r.a = s.c) select * from x x1, x x2; a | a ---+--- - 3 | 1 - 3 | 2 - 3 | 1 - 3 | 2 - 3 | 1 - 3 | 2 - 3 | 1 - 3 | 2 - 3 | 1 - 3 | 2 - 3 | 3 - 3 | 4 - 3 | 5 - 3 | 6 - 3 | 3 - 3 | 4 - 3 | 5 - 3 | 6 - 3 | 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- 1 | 1 - 1 | 2 - 1 | 1 - 1 | 2 - 1 | 1 - 1 | 2 - 1 | 3 - 1 | 4 - 1 | 5 - 1 | 6 - 1 | 3 - 1 | 4 - 1 | 5 - 1 | 6 - 1 | 3 - 1 | 4 - 1 | 5 - 1 | 6 - 1 | 3 - 1 | 4 - 1 | 5 - 1 | 6 2 | 1 - 2 | 2 2 | 1 - 2 | 2 2 | 1 - 2 | 2 2 | 1 - 2 | 2 2 | 1 2 | 2 2 | 3 2 | 4 - 2 | 5 - 2 | 6 - 2 | 3 - 2 | 4 - 2 | 5 - 2 | 6 - 2 | 3 - 2 | 4 - 2 | 5 - 2 | 6 - 2 | 3 - 2 | 4 - 2 | 5 - 2 | 6 - 1 | 1 - 1 | 2 - 1 | 1 - 1 | 2 - 1 | 1 - 1 | 2 - 1 | 1 - 1 | 2 - 1 | 1 - 1 | 2 - 1 | 3 - 1 | 4 - 1 | 5 - 1 | 6 - 1 | 3 - 1 | 4 - 1 | 5 - 1 | 6 - 1 | 3 - 1 | 4 - 1 | 5 - 1 | 6 - 1 | 3 - 1 | 4 - 1 | 5 - 1 | 6 - 2 | 1 - 2 | 2 - 2 | 1 - 2 | 2 - 2 | 1 - 2 | 2 - 2 | 1 - 2 | 2 - 2 | 1 2 | 2 2 | 3 2 | 4 - 2 | 5 - 2 | 6 - 2 | 3 - 2 | 4 - 2 | 5 - 2 | 6 + 2 | 2 2 | 3 2 | 4 - 2 | 5 - 2 | 6 + 2 | 2 2 | 3 2 | 4 - 2 | 5 - 2 | 6 - 6 | 5 - 6 | 6 - 6 | 3 - 6 | 4 - 6 | 5 - 6 | 6 - 6 | 3 - 6 | 4 - 6 | 5 - 6 | 6 + 2 | 2 (676 rows) with x as (select * from orca.rcte where a < 10) (select a from x x2) union all (select max(a) from x x1); a --- - 1 2 3 4 - 5 - 6 7 8 + 1 + 5 + 6 9 9 (10 rows) @@ -7962,7 +7968,7 @@ ERROR: more than one row returned by a subquery used as an expression select (select generate_series(1,5)); ERROR: more than one row returned by a subquery used as an expression select (select a from orca.foo inner1 where inner1.a=outer1.a union select b from orca.foo inner2 where inner2.b=outer1.b) from orca.foo outer1; -ERROR: more than one row returned by a subquery used as an expression (seg0 slice3 192.168.0.37:25432 pid=14095) +ERROR: more than one row returned by a subquery used as an expression (seg2 slice3 127.0.1.1:6004 pid=663328) select (select generate_series(1,1)) as series; series -------- @@ -8100,10 +8106,10 @@ group by ten having exists (select 1 from orca.onek b where sum(distinct a.four) = b.four); ten | sum -----+----- - 0 | 2 - 1 | 3 3 | 3 4 | 2 + 0 | 2 + 1 | 3 9 | 3 (5 rows) @@ -8113,7 +8119,6 @@ NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. NOTICE: CREATE TABLE will create partition "pp_1_prt_pp1" for table "pp" create index pp_a on orca.pp(a); -NOTICE: building index for child partition "pp_1_prt_pp1" -- list partition tests -- test homogeneous partitions drop table if exists orca.t; @@ -8200,8 +8205,8 @@ insert into orca.multilevel_p values (1,1), (100,200); select * from orca.multilevel_p; a | b -----+----- - 1 | 1 100 | 200 + 1 | 1 (2 rows) -- test appendonly @@ -8372,23 +8377,26 @@ set optimizer_enable_space_pruning=off; set optimizer_enable_constant_expression_evaluation=on; set optimizer_enumerate_plans=on; set optimizer_plan_id = 2; +-- start_ignore +analyze orca.t_date; +-- end_ignore explain select * from orca.t_date where user_id=9; QUERY PLAN ------------------------------------------------------------------------------------ Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..8.19 rows=6 width=21) -> Append (cost=0.00..8.19 rows=2 width=21) -> Seq Scan on t_date_1_prt_part201203 (cost=0.00..3.12 rows=1 width=20) - Filter: user_id = 9::numeric + Filter: (user_id = '9'::numeric) -> Seq Scan on t_date_1_prt_part201204 (cost=0.00..1.01 rows=1 width=21) - Filter: user_id = 9::numeric + Filter: (user_id = '9'::numeric) -> Seq Scan on t_date_1_prt_part201205 (cost=0.00..1.01 rows=1 width=21) - Filter: user_id = 9::numeric + Filter: (user_id = '9'::numeric) -> Seq Scan on t_date_1_prt_part201206 (cost=0.00..1.01 rows=1 width=21) - Filter: user_id = 9::numeric + Filter: (user_id = '9'::numeric) -> Seq Scan on t_date_1_prt_part201207 (cost=0.00..1.01 rows=1 width=21) - Filter: user_id = 9::numeric + Filter: (user_id = '9'::numeric) -> Seq Scan on t_date_1_prt_part201208 (cost=0.00..1.01 rows=1 width=21) - Filter: user_id = 9::numeric + Filter: (user_id = '9'::numeric) Optimizer: Postgres query optimizer (15 rows) @@ -8430,17 +8438,20 @@ set optimizer_enable_space_pruning=off; set optimizer_enable_constant_expression_evaluation=on; set optimizer_enumerate_plans=on; set optimizer_plan_id = 2; +-- start_ignore +analyze orca.t_text; +-- end_ignore explain select * from orca.t_text where user_id=9; QUERY PLAN ---------------------------------------------------------------------------------- - Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..7.19 rows=3 width=21) - -> Append (cost=0.00..7.19 rows=1 width=21) + Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..9.19 rows=3 width=21) + -> Append (cost=0.00..9.19 rows=1 width=21) -> Seq Scan on t_text_1_prt_partgood (cost=0.00..3.06 rows=1 width=20) - Filter: user_id = 9::numeric - -> Seq Scan on t_text_1_prt_partbad (cost=0.00..2.06 rows=1 width=21) - Filter: user_id = 9::numeric - -> Seq Scan on t_text_1_prt_partugly (cost=0.00..2.06 rows=1 width=21) - Filter: user_id = 9::numeric + Filter: (user_id = '9'::numeric) + -> Seq Scan on t_text_1_prt_partbad (cost=0.00..3.06 rows=1 width=21) + Filter: (user_id = '9'::numeric) + -> Seq Scan on t_text_1_prt_partugly (cost=0.00..3.06 rows=1 width=21) + Filter: (user_id = '9'::numeric) Optimizer: Postgres query optimizer (9 rows) @@ -8491,15 +8502,18 @@ insert into orca.t_employee values('01-07-2012'::date,1,'tag1','(1, ''foo'')'::o insert into orca.t_employee values('01-08-2012'::date,2,'tag1','(2, ''foo'')'::orca.employee); set optimizer_enable_constant_expression_evaluation=on; set optimizer_enable_dynamictablescan = off; +-- start_ignore +analyze orca.t_employee; +-- end_ignore explain select * from orca.t_employee where user_id = 2; QUERY PLAN ----------------------------------------------------------------------------------- - Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..3.09 rows=4 width=47) - -> Append (cost=0.00..3.09 rows=2 width=47) - -> Seq Scan on t_employee_1_prt_part1 (cost=0.00..2.05 rows=1 width=46) - Filter: user_id = 2::numeric + Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..2.09 rows=4 width=47) + -> Append (cost=0.00..2.09 rows=2 width=47) + -> Seq Scan on t_employee_1_prt_part1 (cost=0.00..1.05 rows=1 width=46) + Filter: (user_id = '2'::numeric) -> Seq Scan on t_employee_1_prt_part2 (cost=0.00..1.04 rows=1 width=47) - Filter: user_id = 2::numeric + Filter: (user_id = '2'::numeric) Optimizer: Postgres query optimizer (7 rows) @@ -8536,17 +8550,20 @@ set optimizer_enable_constant_expression_evaluation=on; set optimizer_use_external_constant_expression_evaluation_for_ints = on; set optimizer_enumerate_plans=on; set optimizer_plan_id = 2; +-- start_ignore +analyze orca.t_ceeval_ints; +-- end_ignore explain select * from orca.t_ceeval_ints where user_id=4; QUERY PLAN ---------------------------------------------------------------------------------------- - Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..4.06 rows=3 width=21) - -> Append (cost=0.00..4.06 rows=1 width=21) - -> Seq Scan on t_ceeval_ints_1_prt_part100 (cost=0.00..2.04 rows=1 width=21) - Filter: user_id = 4::numeric + Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..5.06 rows=3 width=21) + -> Append (cost=0.00..5.06 rows=1 width=21) + -> Seq Scan on t_ceeval_ints_1_prt_part100 (cost=0.00..3.04 rows=1 width=21) + Filter: (user_id = '4'::numeric) -> Seq Scan on t_ceeval_ints_1_prt_part101 (cost=0.00..1.01 rows=1 width=21) - Filter: user_id = 4::numeric + Filter: (user_id = '4'::numeric) -> Seq Scan on t_ceeval_ints_1_prt_part103 (cost=0.00..1.01 rows=1 width=21) - Filter: user_id = 4::numeric + Filter: (user_id = '4'::numeric) Optimizer: Postgres query optimizer (9 rows) @@ -8612,8 +8629,8 @@ select sum(f1.b) from orca.fooh1 f1 group by f1.a; sum ----- 6 - 5 6 + 5 4 (4 rows) @@ -8627,8 +8644,8 @@ select 1 as one, f1.a from orca.fooh1 f1 group by f1.a having sum(f1.b) > 4; one | a -----+--- 1 | 1 - 1 | 2 1 | 0 + 1 | 2 (3 rows) select f1.a, 1 as one from orca.fooh1 f1 group by f1.a having 10 > (select f2.a from orca.fooh2 f2 group by f2.a having sum(f1.a) > count(*) order by f2.a limit 1) order by f1.a; @@ -8722,28 +8739,28 @@ select f1.a, 1 as one from orca.fooh1 f1 group by f1.a having f1.a = (select f2. select sum(f1.a+1)+1 from orca.fooh1 f1 group by f1.a+1; ?column? ---------- - 21 - 16 6 11 + 21 + 16 (4 rows) select sum(f1.a+1)+sum(f1.a+1) from orca.fooh1 f1 group by f1.a+1; ?column? ---------- + 20 40 30 10 - 20 (4 rows) select sum(f1.a+1)+avg(f1.a+1), sum(f1.a), sum(f1.a+1) from orca.fooh1 f1 group by f1.a+1; ?column? | sum | sum ------------------------+-----+----- + 12.0000000000000000 | 5 | 10 24.0000000000000000 | 15 | 20 18.0000000000000000 | 10 | 15 6.00000000000000000000 | 0 | 5 - 12.0000000000000000 | 5 | 10 (4 rows) -- @@ -8774,36 +8791,36 @@ select a, (select sum(e) from bar where foo.b = bar.f), b, count(*) from foo, ja select foo.a, (select (foo.a + foo.b) * count(bar.e) from bar), b, count(*) from foo group by foo.a, foo.b, foo.a + foo.b; a | ?column? | b | count ---+----------+---+------- + 3 | 18 | 3 | 1 2 | 12 | 2 | 1 1 | 6 | 1 | 1 - 3 | 18 | 3 | 1 (3 rows) -- aggfunc over an outer reference in a subquery select (select sum(foo.a + bar.d) from bar) from foo group by a, b; sum ----- - 9 15 12 + 9 (3 rows) -- complex expression of aggfunc over an outer reference in a subquery select (select sum(foo.a + bar.d) + 1 from bar) from foo group by a, b; ?column? ---------- + 16 13 10 - 16 (3 rows) -- aggrefs with multiple agglevelsup select (select (select sum(foo.a + bar.d) from jazz) from bar) from foo group by a, b; sum ----- - 9 15 12 + 9 (3 rows) -- aggrefs with multiple agglevelsup in an expression @@ -8828,9 +8845,9 @@ select (select max(f) from bar where d = 1 group by a, e) from foo group by a; select a, count(*), (with cte as (select min(d) dd from bar group by e) select max(a * dd) from cte) from foo group by a; a | count | max ---+-------+----- - 1 | 1 | 3 2 | 1 | 6 3 | 1 | 9 + 1 | 1 | 3 (3 rows) -- cte with an aggfunc of outer ref in an complex expression @@ -8846,9 +8863,9 @@ select a, count(*), (with cte as (select e, min(d) as dd from bar group by e) se select max(a) from foo group by (select e from bar where bar.e = foo.a); max ----- - 1 2 3 + 1 (3 rows) -- nested subquery in group by @@ -8932,9 +8949,9 @@ select foo.b+1, sum((with cte as (select * from jazz) select 1 from cte where ct select foo.b+1, sum((with cte as (select * from jazz) select 1 from cte cte1, cte cte2 where cte1.h = foo.b)) as t FROM foo GROUP BY foo.b; ?column? | t ----------+--- + 2 | 3 | 1 4 | - 2 | (3 rows) drop table foo, bar, jazz; @@ -8948,9 +8965,9 @@ insert into orca.t77 select 'orange'::text; SELECT to_char(AVG( char_length(DT466.C952) ), '9999999.9999999'), MAX( char_length(DT466.C952) ) FROM orca.t77 DT466 GROUP BY char_length(DT466.C952); to_char | max ------------------+----- + 5.0000000 | 5 6.0000000 | 6 4.0000000 | 4 - 5.0000000 | 5 (3 rows) create table orca.prod9 (sale integer, prodnm varchar,price integer); @@ -8963,8 +8980,8 @@ insert into orca.prod9 values (300, 't-shirts', 300); select prodnm, price from orca.prod9 GROUP BY prodnm, price HAVING price !=300; prodnm | price --------+------- - pants | 800 shirts | 500 + pants | 800 (2 rows) -- analyze on tables with dropped attributes @@ -8997,9 +9014,9 @@ insert into orca.uu values (1,3); select * from (select a, a from orca.ur union select c, d from orca.us) x(g,h); g | h ---+--- + 2 | 2 1 | 1 1 | 3 - 2 | 2 (3 rows) select * from (select a, a from orca.ur union select c, d from orca.us) x(g,h), orca.ut t where t.a = x.h; @@ -9080,7 +9097,7 @@ create table orca.tab1 (i, j) as select i,i%2 from generate_series(1,10) i; NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'i' as the Greenplum Database data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. create table orca.tab2 (a, b) as select 1, 2; -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'a' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named '?column?' as the Greenplum Database data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. select * from orca.tab1 where 0 < (select count(*) from generate_series(1,i)) order by 1; i | j @@ -9100,14 +9117,14 @@ select * from orca.tab1 where 0 < (select count(*) from generate_series(1,i)) or select * from orca.tab1 where i > (select b from orca.tab2); i | j ----+--- - 3 | 1 - 4 | 0 5 | 1 6 | 0 - 7 | 1 - 8 | 0 9 | 1 10 | 0 + 3 | 1 + 4 | 0 + 7 | 1 + 8 | 0 (8 rows) -- subqueries @@ -9229,9 +9246,9 @@ select * from mpp22791 where b > 1; select * from mpp22791 where b <= 3; a | b ---+--- - 1 | 1 2 | 2 3 | 3 + 1 | 1 (3 rows) -- MPP-20713, MPP-20714, MPP-20738: Const table get with a filter @@ -9743,14 +9760,14 @@ select 1 as x where 1 in (2, 3); SELECT generate_series(1,10) EXCEPT SELECT 1; generate_series ----------------- - 2 - 3 + 6 4 5 - 6 - 7 8 + 2 9 + 3 + 7 10 (9 rows) @@ -9765,15 +9782,15 @@ SELECT generate_series(1,10) UNION SELECT 1; generate_series ----------------- 1 - 2 - 3 4 + 3 5 - 6 - 7 - 8 9 + 6 10 + 8 + 7 + 2 (10 rows) -- warning messages for missing stats @@ -9919,9 +9936,8 @@ where c.cid = s.cid and s.date_sk = d.date_sk and Hash Key: s.date_sk -> Seq Scan on sales s (cost=0.00..938.00 rows=28 width=40) Filter: ((lower(type) = 't1'::text) OR (upper(type) = 'T2'::text)) - Planning time: 2.896 ms Optimizer: Postgres query optimizer -(19 rows) +(18 rows) reset optimizer_segments; -- Bitmap indexes @@ -9934,14 +9950,13 @@ insert into orca.bm_test select i % 10, (i % 10)::text from generate_series(1, create index bm_test_idx on orca.bm_test using bitmap (i); set optimizer_enable_bitmapscan=on; explain select * from orca.bm_test where i=2 and t='2'; - QUERY PLAN + QUERY PLAN ---------------------------------------------------------------------------- Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..4.50 rows=4 width=6) -> Seq Scan on bm_test (cost=0.00..4.50 rows=2 width=6) - Filter: i = 2 AND t = '2'::text - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(5 rows) + Filter: ((i = 2) AND (t = '2'::text)) + Optimizer: Postgres query optimizer +(4 rows) select * from orca.bm_test where i=2 and t='2'; i | t @@ -9974,34 +9989,32 @@ NOTICE: CREATE TABLE will create partition "bm_dyn_test_1_prt_part3" for table NOTICE: CREATE TABLE will create partition "bm_dyn_test_1_prt_part4" for table "bm_dyn_test" insert into orca.bm_dyn_test select i % 10, 'drop', i % 5, (i % 10)::text from generate_series(1, 100) i; create index bm_dyn_test_idx on orca.bm_dyn_test using bitmap (i); -NOTICE: building index for child partition "bm_dyn_test_1_prt_part0" -NOTICE: building index for child partition "bm_dyn_test_1_prt_part1" -NOTICE: building index for child partition "bm_dyn_test_1_prt_part2" -NOTICE: building index for child partition "bm_dyn_test_1_prt_part3" -NOTICE: building index for child partition "bm_dyn_test_1_prt_part4" alter table orca.bm_dyn_test drop column to_be_dropped; alter table orca.bm_dyn_test add partition part5 values(5); NOTICE: CREATE TABLE will create partition "bm_dyn_test_1_prt_part5" for table "bm_dyn_test" insert into orca.bm_dyn_test values(2, 5, '2'); set optimizer_enable_dynamicbitmapscan=on; +-- start_ignore +analyze orca.bm_dyn_test; +-- end_ignore -- gather on 1 segment because of direct dispatch explain select * from orca.bm_dyn_test where i=2 and t='2'; QUERY PLAN ------------------------------------------------------------------------------------ - Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..13.52 rows=13 width=10) - -> Append (cost=0.00..13.52 rows=5 width=10) - -> Seq Scan on bm_dyn_test_1_prt_part0 (cost=0.00..2.30 rows=1 width=10) - Filter: i = 2 AND t = '2'::text + Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..9.52 rows=13 width=10) + -> Append (cost=0.00..9.52 rows=5 width=10) + -> Seq Scan on bm_dyn_test_1_prt_part0 (cost=0.00..1.30 rows=1 width=10) + Filter: ((i = 2) AND (t = '2'::text)) -> Seq Scan on bm_dyn_test_1_prt_part1 (cost=0.00..2.30 rows=1 width=10) - Filter: i = 2 AND t = '2'::text - -> Seq Scan on bm_dyn_test_1_prt_part2 (cost=0.00..3.30 rows=3 width=10) - Filter: i = 2 AND t = '2'::text - -> Seq Scan on bm_dyn_test_1_prt_part3 (cost=0.00..2.30 rows=1 width=10) - Filter: i = 2 AND t = '2'::text + Filter: ((i = 2) AND (t = '2'::text)) + -> Seq Scan on bm_dyn_test_1_prt_part2 (cost=0.00..1.30 rows=3 width=10) + Filter: ((i = 2) AND (t = '2'::text)) + -> Seq Scan on bm_dyn_test_1_prt_part3 (cost=0.00..1.30 rows=1 width=10) + Filter: ((i = 2) AND (t = '2'::text)) -> Seq Scan on bm_dyn_test_1_prt_part4 (cost=0.00..2.30 rows=1 width=10) - Filter: i = 2 AND t = '2'::text + Filter: ((i = 2) AND (t = '2'::text)) -> Seq Scan on bm_dyn_test_1_prt_part5 (cost=0.00..1.01 rows=1 width=10) - Filter: i = 2 AND t = '2'::text + Filter: ((i = 2) AND (t = '2'::text)) Optimizer: Postgres query optimizer (15 rows) @@ -10044,24 +10057,27 @@ NOTICE: CREATE TABLE will create partition "bm_dyn_test_onepart_1_prt_part5" fo insert into orca.bm_dyn_test_onepart values(2, 5, '2'); set optimizer_enable_bitmapscan=on; set optimizer_enable_dynamictablescan = off; +-- start_ignore +analyze orca.bm_dyn_test_onepart; +-- end_ignore -- gather on 1 segment because of direct dispatch explain select * from orca.bm_dyn_test_onepart where i=2 and t='2'; QUERY PLAN -------------------------------------------------------------------------------------------- - Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..13.52 rows=13 width=10) - -> Append (cost=0.00..13.52 rows=5 width=10) - -> Seq Scan on bm_dyn_test_onepart_1_prt_part0 (cost=0.00..2.30 rows=1 width=10) - Filter: i = 2 AND t = '2'::text + Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..9.52 rows=13 width=10) + -> Append (cost=0.00..9.52 rows=5 width=10) + -> Seq Scan on bm_dyn_test_onepart_1_prt_part0 (cost=0.00..1.30 rows=1 width=10) + Filter: ((i = 2) AND (t = '2'::text)) -> Seq Scan on bm_dyn_test_onepart_1_prt_part1 (cost=0.00..2.30 rows=1 width=10) - Filter: i = 2 AND t = '2'::text - -> Seq Scan on bm_dyn_test_onepart_1_prt_part2 (cost=0.00..3.30 rows=3 width=10) - Filter: i = 2 AND t = '2'::text - -> Seq Scan on bm_dyn_test_onepart_1_prt_part3 (cost=0.00..2.30 rows=1 width=10) - Filter: i = 2 AND t = '2'::text + Filter: ((i = 2) AND (t = '2'::text)) + -> Seq Scan on bm_dyn_test_onepart_1_prt_part2 (cost=0.00..1.30 rows=3 width=10) + Filter: ((i = 2) AND (t = '2'::text)) + -> Seq Scan on bm_dyn_test_onepart_1_prt_part3 (cost=0.00..1.30 rows=1 width=10) + Filter: ((i = 2) AND (t = '2'::text)) -> Seq Scan on bm_dyn_test_onepart_1_prt_part4 (cost=0.00..2.30 rows=1 width=10) - Filter: i = 2 AND t = '2'::text + Filter: ((i = 2) AND (t = '2'::text)) -> Seq Scan on bm_dyn_test_onepart_1_prt_part5 (cost=0.00..1.01 rows=1 width=10) - Filter: i = 2 AND t = '2'::text + Filter: ((i = 2) AND (t = '2'::text)) Optimizer: Postgres query optimizer (15 rows) @@ -10115,7 +10131,7 @@ analyze orca.bm_dyn_test_multilvl_part; explain select * from orca.bm_dyn_test_multilvl_part where year = 2019; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..7.69 rows=53 width=18) + Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..6.62 rows=53 width=18) -> Append (cost=0.00..6.62 rows=18 width=18) -> Seq Scan on bm_dyn_test_multilvl_part_1_prt_2_2_prt_1_3_prt_usa (cost=0.00..1.00 rows=1 width=44) Filter: (year = 2019) @@ -10152,11 +10168,6 @@ NOTICE: CREATE TABLE will create partition "het_bm_1_prt_part3" for table "het_ NOTICE: CREATE TABLE will create partition "het_bm_1_prt_part4" for table "het_bm" insert into bm.het_bm select i % 10, 'drop', i % 5, (i % 10)::text from generate_series(1, 100) i; create index het_bm_idx on bm.het_bm using bitmap (i); -NOTICE: building index for child partition "het_bm_1_prt_part0" -NOTICE: building index for child partition "het_bm_1_prt_part1" -NOTICE: building index for child partition "het_bm_1_prt_part2" -NOTICE: building index for child partition "het_bm_1_prt_part3" -NOTICE: building index for child partition "het_bm_1_prt_part4" alter table bm.het_bm drop column to_be_dropped; alter table bm.het_bm add partition part5 values(5); NOTICE: CREATE TABLE will create partition "het_bm_1_prt_part5" for table "het_bm" @@ -10183,11 +10194,6 @@ NOTICE: CREATE TABLE will create partition "hom_bm_heap_1_prt_part3" for table NOTICE: CREATE TABLE will create partition "hom_bm_heap_1_prt_part4" for table "hom_bm_heap" insert into bm.hom_bm_heap select i % 10, 'drop', i % 5, (i % 10)::text from generate_series(1, 100) i; create index hom_bm_heap_idx on bm.hom_bm_heap using bitmap (i); -NOTICE: building index for child partition "hom_bm_heap_1_prt_part0" -NOTICE: building index for child partition "hom_bm_heap_1_prt_part1" -NOTICE: building index for child partition "hom_bm_heap_1_prt_part2" -NOTICE: building index for child partition "hom_bm_heap_1_prt_part3" -NOTICE: building index for child partition "hom_bm_heap_1_prt_part4" alter table bm.hom_bm_heap drop column to_be_dropped; alter table bm.hom_bm_heap add partition part5 values(5); NOTICE: CREATE TABLE will create partition "hom_bm_heap_1_prt_part5" for table "hom_bm_heap" @@ -10216,11 +10222,6 @@ NOTICE: CREATE TABLE will create partition "hom_bm_ao_1_prt_part3" for table "h NOTICE: CREATE TABLE will create partition "hom_bm_ao_1_prt_part4" for table "hom_bm_ao" insert into bm.hom_bm_ao select i % 10, 'drop', i % 5, (i % 10)::text from generate_series(1, 100) i; create index hom_bm_ao_idx on bm.hom_bm_ao using bitmap (i); -NOTICE: building index for child partition "hom_bm_ao_1_prt_part0" -NOTICE: building index for child partition "hom_bm_ao_1_prt_part1" -NOTICE: building index for child partition "hom_bm_ao_1_prt_part2" -NOTICE: building index for child partition "hom_bm_ao_1_prt_part3" -NOTICE: building index for child partition "hom_bm_ao_1_prt_part4" alter table bm.hom_bm_ao drop column to_be_dropped; alter table bm.hom_bm_ao add partition part5 values(5); NOTICE: CREATE TABLE will create partition "hom_bm_ao_1_prt_part5" for table "hom_bm_ao" @@ -10249,11 +10250,6 @@ NOTICE: CREATE TABLE will create partition "hom_bm_aoco_1_prt_part3" for table NOTICE: CREATE TABLE will create partition "hom_bm_aoco_1_prt_part4" for table "hom_bm_aoco" insert into bm.hom_bm_aoco select i % 10, 'drop', i % 5, (i % 10)::text from generate_series(1, 100) i; create index hom_bm_aoco_idx on bm.hom_bm_aoco using bitmap (i); -NOTICE: building index for child partition "hom_bm_aoco_1_prt_part0" -NOTICE: building index for child partition "hom_bm_aoco_1_prt_part1" -NOTICE: building index for child partition "hom_bm_aoco_1_prt_part2" -NOTICE: building index for child partition "hom_bm_aoco_1_prt_part3" -NOTICE: building index for child partition "hom_bm_aoco_1_prt_part4" alter table bm.hom_bm_aoco drop column to_be_dropped; alter table bm.hom_bm_aoco add partition part5 values(5); NOTICE: CREATE TABLE will create partition "hom_bm_aoco_1_prt_part5" for table "hom_bm_aoco" @@ -10279,17 +10275,7 @@ NOTICE: CREATE TABLE will create partition "het_bm_1_prt_part4" for table "het_ insert into bm.het_bm select i % 10, 'drop', i % 5, (i % 10)::text from generate_series(1, 100) i; -- Create index before dropping a column create index het_bm_i_idx on bm.het_bm using bitmap (i); -NOTICE: building index for child partition "het_bm_1_prt_part0" -NOTICE: building index for child partition "het_bm_1_prt_part1" -NOTICE: building index for child partition "het_bm_1_prt_part2" -NOTICE: building index for child partition "het_bm_1_prt_part3" -NOTICE: building index for child partition "het_bm_1_prt_part4" create index het_bm_j_idx on bm.het_bm using bitmap (j); -NOTICE: building index for child partition "het_bm_1_prt_part0" -NOTICE: building index for child partition "het_bm_1_prt_part1" -NOTICE: building index for child partition "het_bm_1_prt_part2" -NOTICE: building index for child partition "het_bm_1_prt_part3" -NOTICE: building index for child partition "het_bm_1_prt_part4" alter table bm.het_bm drop column to_be_dropped; alter table bm.het_bm add partition part5 values(5); NOTICE: CREATE TABLE will create partition "het_bm_1_prt_part5" for table "het_bm" @@ -10310,19 +10296,7 @@ select sum(i) i_sum, sum(j) j_sum, sum(t::integer) t_sum from bm.het_bm where i= drop index bm.het_bm_i_idx; drop index bm.het_bm_j_idx; create index het_bm_i_idx on bm.het_bm using bitmap (i); -NOTICE: building index for child partition "het_bm_1_prt_part0" -NOTICE: building index for child partition "het_bm_1_prt_part1" -NOTICE: building index for child partition "het_bm_1_prt_part2" -NOTICE: building index for child partition "het_bm_1_prt_part3" -NOTICE: building index for child partition "het_bm_1_prt_part4" -NOTICE: building index for child partition "het_bm_1_prt_part5" create index het_bm_j_idx on bm.het_bm using bitmap (j); -NOTICE: building index for child partition "het_bm_1_prt_part0" -NOTICE: building index for child partition "het_bm_1_prt_part1" -NOTICE: building index for child partition "het_bm_1_prt_part2" -NOTICE: building index for child partition "het_bm_1_prt_part3" -NOTICE: building index for child partition "het_bm_1_prt_part4" -NOTICE: building index for child partition "het_bm_1_prt_part5" select sum(i) i_sum, sum(j) j_sum, sum(t::integer) t_sum from bm.het_bm where j=2 or j=3; i_sum | j_sum | t_sum -------+-------+------- @@ -10347,19 +10321,7 @@ alter table bm.het_bm add partition part5 values(5); NOTICE: CREATE TABLE will create partition "het_bm_1_prt_part5" for table "het_bm" -- Create index after dropping a column but before we insert into newly created part create index het_bm_i_idx on bm.het_bm using bitmap (i); -NOTICE: building index for child partition "het_bm_1_prt_part0" -NOTICE: building index for child partition "het_bm_1_prt_part1" -NOTICE: building index for child partition "het_bm_1_prt_part2" -NOTICE: building index for child partition "het_bm_1_prt_part3" -NOTICE: building index for child partition "het_bm_1_prt_part4" -NOTICE: building index for child partition "het_bm_1_prt_part5" create index het_bm_j_idx on bm.het_bm using bitmap (j); -NOTICE: building index for child partition "het_bm_1_prt_part0" -NOTICE: building index for child partition "het_bm_1_prt_part1" -NOTICE: building index for child partition "het_bm_1_prt_part2" -NOTICE: building index for child partition "het_bm_1_prt_part3" -NOTICE: building index for child partition "het_bm_1_prt_part4" -NOTICE: building index for child partition "het_bm_1_prt_part5" insert into bm.het_bm values(2, 5, '2'); select sum(i) i_sum, sum(j) j_sum, sum(t::integer) t_sum from bm.het_bm where j=2 or j=3; i_sum | j_sum | t_sum @@ -10436,28 +10398,29 @@ END; $$ LANGUAGE plpgsql volatile; -- start_ignore select disable_xform('CXformInnerJoin2DynamicIndexGetApply'); - disable_xform --------------------------------------------------- - CXformInnerJoin2DynamicIndexGetApply is disabled + disable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) select disable_xform('CXformInnerJoin2HashJoin'); - disable_xform --------------------------------------- - CXformInnerJoin2HashJoin is disabled + disable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) select disable_xform('CXformInnerJoin2IndexGetApply'); - disable_xform -------------------------------------------- - CXformInnerJoin2IndexGetApply is disabled + disable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) select disable_xform('CXformInnerJoin2NLJoin'); - disable_xform ------------------------------------- - CXformInnerJoin2NLJoin is disabled + disable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) + -- end_ignore set optimizer_enable_partial_index=on; set optimizer_enable_indexjoin=on; @@ -10472,21 +10435,21 @@ WHERE tq.sym = tt.symbol AND tt.event_ts < tq.end_ts GROUP BY 1 ORDER BY 1 asc ; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) (cost=240615.63..240618.13 rows=1000 width=16) - Merge Key: (tt.event_ts / 100000 / 5 * 5) - -> Sort (cost=240615.63..240618.13 rows=334 width=16) - Sort Key: (tt.event_ts / 100000 / 5 * 5) - -> HashAggregate (cost=240553.30..240565.80 rows=334 width=16) - Group By: (tt.event_ts / 100000 / 5 * 5) - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=240510.80..240538.30 rows=334 width=16) - Hash Key: (tt.event_ts / 100000 / 5 * 5) - -> HashAggregate (cost=240510.80..240518.30 rows=334 width=16) - Group By: tt.event_ts / 100000 / 5 * 5 - -> Hash Join (cost=604.00..240341.56 rows=11283 width=8) - Hash Cond: tq.sym::bpchar = tt.symbol - Join Filter: tt.event_ts >= tq.ets AND tt.event_ts < tq.end_ts AND plusone(tq.bid_price) < tt.trade_price + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------- + Gather Motion 3:1 (slice3; segments: 3) (cost=352568.33..352570.83 rows=1000 width=16) + Merge Key: ((((tt.event_ts / 100000) / 5) * 5)) + -> Sort (cost=352568.33..352570.83 rows=334 width=16) + Sort Key: ((((tt.event_ts / 100000) / 5) * 5)) + -> HashAggregate (cost=352508.50..352518.50 rows=334 width=16) + Group Key: ((((tt.event_ts / 100000) / 5) * 5)) + -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=352466.00..352493.50 rows=334 width=16) + Hash Key: ((((tt.event_ts / 100000) / 5) * 5)) + -> HashAggregate (cost=352466.00..352473.50 rows=334 width=16) + Group Key: (((tt.event_ts / 100000) / 5) * 5) + -> Hash Join (cost=604.00..352296.76 rows=11283 width=8) + Hash Cond: ((tq.sym)::bpchar = tt.symbol) + Join Filter: ((tt.event_ts >= tq.ets) AND (tt.event_ts < tq.end_ts) AND (plusone(tq.bid_price) < tt.trade_price)) -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..1424.00 rows=13600 width=98) Hash Key: tq.sym -> Append (cost=0.00..608.00 rows=13600 width=98) @@ -10494,9 +10457,8 @@ ORDER BY 1 asc ; -> Seq Scan on my_tq_agg_opt_part_1_prt_p2 tq_1 (cost=0.00..304.00 rows=6800 width=98) -> Hash (cost=324.00..324.00 rows=7467 width=108) -> Seq Scan on my_tt_agg_opt tt (cost=0.00..324.00 rows=7467 width=108) - Settings: optimizer=off; optimizer_cte_inlining_bound=1000; optimizer_segments=3 - Optimizer status: Postgres query optimizer -(22 rows) + Optimizer: Postgres query optimizer +(21 rows) reset optimizer_segments; reset optimizer_enable_constant_expression_evaluation; @@ -10504,27 +10466,27 @@ reset optimizer_enable_indexjoin; reset optimizer_enable_partial_index; -- start_ignore select enable_xform('CXformInnerJoin2DynamicIndexGetApply'); - enable_xform -------------------------------------------------- - CXformInnerJoin2DynamicIndexGetApply is enabled + enable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) select enable_xform('CXformInnerJoin2HashJoin'); - enable_xform -------------------------------------- - CXformInnerJoin2HashJoin is enabled + enable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) select enable_xform('CXformInnerJoin2IndexGetApply'); - enable_xform ------------------------------------------- - CXformInnerJoin2IndexGetApply is enabled + enable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) select enable_xform('CXformInnerJoin2NLJoin'); - enable_xform ------------------------------------ - CXformInnerJoin2NLJoin is enabled + enable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) -- end_ignore @@ -10566,27 +10528,26 @@ analyze idxscan_inner; set optimizer_enable_hashjoin = off; explain select id, comment from idxscan_outer as o join idxscan_inner as i on o.id = i.productid where ordernum between 10 and 20; - QUERY PLAN + QUERY PLAN ---------------------------------------------------------------------------------------------------- Gather Motion 3:1 (slice2; segments: 3) (cost=2.12..5.28 rows=4 width=9) -> Hash Join (cost=2.12..5.28 rows=2 width=9) - Hash Cond: o.id = i.productid + Hash Cond: (o.id = i.productid) -> Seq Scan on idxscan_outer o (cost=0.00..3.09 rows=3 width=4) -> Hash (cost=2.09..2.09 rows=1 width=9) -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..2.09 rows=1 width=9) Hash Key: i.productid -> Seq Scan on idxscan_inner i (cost=0.00..2.04 rows=1 width=9) - Filter: ordernum >= 10 AND ordernum <= 20 - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(11 rows) + Filter: ((ordernum >= 10) AND (ordernum <= 20)) + Optimizer: Postgres query optimizer +(10 rows) select id, comment from idxscan_outer as o join idxscan_inner as i on o.id = i.productid where ordernum between 10 and 20; id | comment ----+--------- - 1 | xxxx 3 | zzzz + 1 | xxxx (2 rows) reset optimizer_enable_hashjoin; @@ -10624,36 +10585,33 @@ create table orca.index_test (a int, b int, c int, d int, e int, constraint inde insert into orca.index_test select i,i%2,i%3,i%4,i%5 from generate_series(1,100) i; -- force_explain explain select * from orca.index_test where a = 5; - QUERY PLAN --------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.25 rows=1 width=20) -> Seq Scan on index_test (cost=0.00..4.25 rows=1 width=20) - Filter: a = 5 - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(5 rows) + Filter: (a = 5) + Optimizer: Postgres query optimizer +(4 rows) -- force_explain explain select * from orca.index_test where c = 5; - QUERY PLAN --------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.25 rows=1 width=20) -> Seq Scan on index_test (cost=0.00..4.25 rows=1 width=20) - Filter: c = 5 - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(5 rows) + Filter: (c = 5) + Optimizer: Postgres query optimizer +(4 rows) -- force_explain explain select * from orca.index_test where a = 5 and c = 5; - QUERY PLAN --------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.50 rows=1 width=20) -> Seq Scan on index_test (cost=0.00..4.50 rows=1 width=20) - Filter: a = 5 AND c = 5 - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(5 rows) + Filter: ((a = 5) AND (c = 5)) + Optimizer: Postgres query optimizer +(4 rows) -- renaming columns select * from (values (2),(null)) v(k); @@ -10715,6 +10673,7 @@ drop table can_set_tag_target; drop table can_set_tag_audit; -- start_ignore create language plpythonu; +ERROR: language "plpythonu" already exists -- end_ignore -- Checking if ORCA uses parser's canSetTag for CREATE TABLE AS SELECT create or replace function canSetTag_Func(x int) returns int as $$ @@ -10740,9 +10699,9 @@ CREATE INDEX btree_test_index ON btree_test(a); set optimizer_enable_tablescan = off; -- start_ignore select disable_xform('CXformSelect2IndexGet'); - disable_xform ------------------------------------ - CXformSelect2IndexGet is disabled + disable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) -- end_ignore @@ -10785,9 +10744,9 @@ EXPLAIN SELECT * FROM btree_test WHERE a in ('1', '2', 47); SELECT * FROM btree_test WHERE a in ('1', '2', 47); a | b ----+---- + 2 | 2 1 | 1 47 | 47 - 2 | 2 (3 rows) CREATE INDEX btree_test_index_ab ON btree_test using btree(a,b); @@ -10803,15 +10762,15 @@ EXPLAIN SELECT * FROM btree_test WHERE a in (1, 2, 47) AND b > 1; SELECT * FROM btree_test WHERE a in (1, 2, 47) AND b > 1; a | b ----+---- - 2 | 2 47 | 47 + 2 | 2 (2 rows) -- start_ignore select enable_xform('CXformSelect2IndexGet'); - enable_xform ----------------------------------- - CXformSelect2IndexGet is enabled + enable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) -- end_ignore @@ -10820,59 +10779,53 @@ reset optimizer_enable_tablescan; CREATE TABLE bitmap_test as SELECT * FROM generate_series(1,100) as a distributed randomly; CREATE INDEX bitmap_index ON bitmap_test USING BITMAP(a); EXPLAIN SELECT * FROM bitmap_test WHERE a in (1); - QUERY PLAN --------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.25 rows=1 width=4) -> Seq Scan on bitmap_test (cost=0.00..4.25 rows=1 width=4) - Filter: a = 1 - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(5 rows) + Filter: (a = 1) + Optimizer: Postgres query optimizer +(4 rows) EXPLAIN SELECT * FROM bitmap_test WHERE a in (1, 47); - QUERY PLAN --------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.25 rows=2 width=4) -> Seq Scan on bitmap_test (cost=0.00..4.25 rows=1 width=4) - Filter: a = ANY ('{1,47}'::integer[]) - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(5 rows) + Filter: (a = ANY ('{1,47}'::integer[])) + Optimizer: Postgres query optimizer +(4 rows) EXPLAIN SELECT * FROM bitmap_test WHERE a in ('2', 47); - QUERY PLAN --------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.25 rows=2 width=4) -> Seq Scan on bitmap_test (cost=0.00..4.25 rows=1 width=4) - Filter: a = ANY ('{2,47}'::integer[]) - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(5 rows) + Filter: (a = ANY ('{2,47}'::integer[])) + Optimizer: Postgres query optimizer +(4 rows) EXPLAIN SELECT * FROM bitmap_test WHERE a in ('1', '2'); - QUERY PLAN --------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.25 rows=2 width=4) -> Seq Scan on bitmap_test (cost=0.00..4.25 rows=1 width=4) - Filter: a = ANY ('{1,2}'::integer[]) - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(5 rows) + Filter: (a = ANY ('{1,2}'::integer[])) + Optimizer: Postgres query optimizer +(4 rows) EXPLAIN SELECT * FROM bitmap_test WHERE a in ('1', '2', 47); - QUERY PLAN --------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.38 rows=3 width=4) -> Seq Scan on bitmap_test (cost=0.00..4.38 rows=1 width=4) - Filter: a = ANY ('{1,2,47}'::integer[]) - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(5 rows) + Filter: (a = ANY ('{1,2,47}'::integer[])) + Optimizer: Postgres query optimizer +(4 rows) -- Test Logging for unsupported features in ORCA -- start_ignore drop table if exists foo; -NOTICE: table "foo" does not exist, skipping -- end_ignore create table foo(a int, b int) distributed by (a); -- The amount of log messages you get depends on a lot of options, but any @@ -10882,37 +10835,37 @@ set log_statement='none'; set log_min_duration_statement=-1; set client_min_messages='log'; explain select count(*) from foo group by cube(a,b); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------- Gather Motion 3:1 (slice3; segments: 3) (cost=10128.79..20306.02 rows=40897 width=28) -> Append (cost=10128.79..20306.02 rows=13633 width=28) -> HashAggregate (cost=10128.79..10408.61 rows=9328 width=28) - Group Key: "rollup".unnamed_attr_2, "rollup".unnamed_attr_1, "rollup"."grouping", "rollup"."group_id" + Group Key: "rollup".prelim_aggref_2, "rollup".prelim_aggref_1, "rollup"."grouping", "rollup"."group_id" -> Subquery Scan on "rollup" (cost=8552.10..10074.98 rows=1435 width=28) -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=8552.10..10031.93 rows=1435 width=28) - Hash Key: rollup_1.unnamed_attr_2, rollup_1.unnamed_attr_1, (Grouping), group_id() + Hash Key: rollup_1.prelim_aggref_2, rollup_1.prelim_aggref_1, (Grouping), group_id() -> GroupAggregate (cost=8552.10..9945.83 rows=1435 width=28) - Group Key: rollup_1."grouping", rollup_1."group_id" + Group Key: rollup_1."grouping", rollup_1."group_id", rollup_1.prelim_aggref_2, rollup_1.prelim_aggref_1 -> Subquery Scan on rollup_1 (cost=8552.10..9822.06 rows=2153 width=28) -> GroupAggregate (cost=8552.10..9757.49 rows=2153 width=28) - Group Key: rollup_2.unnamed_attr_2, rollup_2."grouping", rollup_2."group_id" + Group Key: rollup_2.prelim_aggref_2, rollup_2."grouping", rollup_2."group_id", rollup_2.prelim_aggref_1 -> Subquery Scan on rollup_2 (cost=8552.10..9585.30 rows=2870 width=28) -> GroupAggregate (cost=8552.10..9499.20 rows=2870 width=28) - Group Key: b, a + Group Key: share0_ref1.b, share0_ref1.a -> Sort (cost=8552.10..8767.35 rows=28700 width=8) - Sort Key: b, a + Sort Key: share0_ref1.b, share0_ref1.a -> Shared Scan (share slice:id 1:0) (cost=1391.50..1494.60 rows=28700 width=8) -> Materialize (cost=0.00..1391.50 rows=28700 width=8) -> Seq Scan on foo (cost=0.00..961.00 rows=28700 width=8) -> HashAggregate (cost=9639.11..9768.26 rows=4305 width=28) - Group Key: rollup_3.unnamed_attr_1, rollup_3.unnamed_attr_2, rollup_3."grouping", rollup_3."group_id" + Group Key: rollup_3.prelim_aggref_1, rollup_3.prelim_aggref_2, rollup_3."grouping", rollup_3."group_id" -> Subquery Scan on rollup_3 (cost=8552.10..9585.30 rows=1435 width=28) -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=8552.10..9542.25 rows=1435 width=28) - Hash Key: a, b, (Grouping), group_id() + Hash Key: share0_ref2.a, share0_ref2.b, (Grouping), group_id() -> GroupAggregate (cost=8552.10..9456.15 rows=1435 width=28) - Group Key: a + Group Key: share0_ref2.a, share0_ref2.b -> Sort (cost=8552.10..8767.35 rows=28700 width=8) - Sort Key: a, b + Sort Key: share0_ref2.a, share0_ref2.b -> Shared Scan (share slice:id 2:0) (cost=1391.50..1494.60 rows=28700 width=8) Optimizer: Postgres query optimizer (31 rows) @@ -11022,14 +10975,13 @@ HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sur -- end_ignore -- Query should not fallback to planner explain select * from foo where b in ('1', '2'); - QUERY PLAN --------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..667.50 rows=91 width=42) -> Seq Scan on foo (cost=0.00..667.50 rows=31 width=42) - Filter: b::text = ANY ('{1,2}'::text[]) - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(5 rows) + Filter: ((b)::text = ANY ('{1,2}'::text[])) + Optimizer: Postgres query optimizer +(4 rows) set optimizer_enable_ctas = off; set log_statement='none'; @@ -11115,7 +11067,7 @@ FROM (SELECT * -> Subquery Scan on a (cost=1.04..3.24 rows=2 width=0) -> Append (cost=1.04..3.20 rows=2 width=4) -> Hash Left Join (cost=1.04..2.14 rows=2 width=3) - Hash Cond: tab_1.id::text = tab_2.id::text + Hash Cond: ((tab_1.id)::text = (tab_2.id)::text) -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..1.06 rows=1 width=5) Hash Key: tab_1.id -> Seq Scan on tab_1 (cost=0.00..1.02 rows=1 width=5) @@ -11163,32 +11115,32 @@ set optimizer_enable_streaming_material = on; select c1 from t_outer where not c1 =all (select c2 from t_inner); c1 ---- - 8 - 9 + 7 10 - 1 - 2 3 - 4 - 5 6 - 7 + 2 + 1 + 5 + 8 + 4 + 9 (10 rows) set optimizer_enable_streaming_material = off; select c1 from t_outer where not c1 =all (select c2 from t_inner); c1 ---- - 8 - 9 - 10 - 1 - 2 3 - 4 - 5 6 7 + 10 + 2 + 1 + 5 + 8 + 4 + 9 (10 rows) reset optimizer_enable_streaming_material; @@ -11288,10 +11240,10 @@ insert into y_tab select 1 union all select a from x_tab limit 10; select * from y_tab; a --- + 0 1 1 1 - 0 (4 rows) -- @@ -11359,18 +11311,17 @@ INSERT INTO csq_cast_param_inner VALUES (11, '11'), (101, '12'); EXPLAIN SELECT a FROM csq_cast_param_outer WHERE b in (SELECT CASE WHEN a > 1 THEN d ELSE '42' END FROM csq_cast_param_inner); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------ - Gather Motion 3:1 (slice2; segments: 3) (cost=1.11..2.49 rows=4 width=4) - -> Nested Loop Semi Join (cost=1.11..2.49 rows=2 width=4) - Join Filter: CASE WHEN csq_cast_param_outer.a > 1 THEN csq_cast_param_inner.d ELSE '42'::myint END::bigint = csq_cast_param_outer.b::bigint - -> Seq Scan on csq_cast_param_outer (cost=0.00..1.02 rows=1 width=8) - -> Materialize (cost=1.11..1.17 rows=2 width=4) - -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..1.10 rows=2 width=4) - -> Seq Scan on csq_cast_param_inner (cost=0.00..1.02 rows=1 width=4) - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(9 rows) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------- + Gather Motion 3:1 (slice2; segments: 3) (cost=10000000000.00..10000000004.40 rows=4 width=4) + -> Nested Loop Semi Join (cost=10000000000.00..10000000004.40 rows=2 width=4) + Join Filter: ((CASE WHEN (csq_cast_param_outer.a > 1) THEN csq_cast_param_inner.d ELSE '42'::myint END)::bigint = (csq_cast_param_outer.b)::bigint) + -> Seq Scan on csq_cast_param_outer (cost=0.00..2.02 rows=1 width=8) + -> Materialize (cost=0.00..2.13 rows=2 width=4) + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..2.10 rows=2 width=4) + -> Seq Scan on csq_cast_param_inner (cost=0.00..2.02 rows=1 width=4) + Optimizer: Postgres query optimizer +(8 rows) SELECT a FROM csq_cast_param_outer WHERE b in (SELECT CASE WHEN a > 1 THEN d ELSE '42' END FROM csq_cast_param_inner); a @@ -11383,24 +11334,23 @@ DROP CAST (myint as int8); CREATE FUNCTION myint_numeric(myint) RETURNS numeric AS 'int4_numeric' LANGUAGE INTERNAL STRICT IMMUTABLE; CREATE CAST (myint AS numeric) WITH FUNCTION myint_numeric(myint) AS IMPLICIT; EXPLAIN SELECT a FROM csq_cast_param_outer WHERE b in (SELECT CASE WHEN a > 1 THEN d ELSE '42' END FROM csq_cast_param_inner); - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice2; segments: 3) (cost=1.11..2.49 rows=4 width=4) - -> Nested Loop Semi Join (cost=1.11..2.49 rows=2 width=4) - Join Filter: CASE WHEN csq_cast_param_outer.a > 1 THEN csq_cast_param_inner.d ELSE '42'::myint END::numeric = csq_cast_param_outer.b::numeric - -> Seq Scan on csq_cast_param_outer (cost=0.00..1.02 rows=1 width=8) - -> Materialize (cost=1.11..1.17 rows=2 width=4) - -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..1.10 rows=2 width=4) - -> Seq Scan on csq_cast_param_inner (cost=0.00..1.02 rows=1 width=4) - Settings: optimizer=off - Optimizer status: Postgres query optimizer -(9 rows) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- + Gather Motion 3:1 (slice2; segments: 3) (cost=10000000000.00..10000000004.40 rows=4 width=4) + -> Nested Loop Semi Join (cost=10000000000.00..10000000004.40 rows=2 width=4) + Join Filter: ((CASE WHEN (csq_cast_param_outer.a > 1) THEN csq_cast_param_inner.d ELSE '42'::myint END)::numeric = (csq_cast_param_outer.b)::numeric) + -> Seq Scan on csq_cast_param_outer (cost=0.00..2.02 rows=1 width=8) + -> Materialize (cost=0.00..2.13 rows=2 width=4) + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..2.10 rows=2 width=4) + -> Seq Scan on csq_cast_param_inner (cost=0.00..2.02 rows=1 width=4) + Optimizer: Postgres query optimizer +(8 rows) SELECT a FROM csq_cast_param_outer WHERE b in (SELECT CASE WHEN a > 1 THEN d ELSE '42' END FROM csq_cast_param_inner); a --- - 1 2 + 1 (2 rows) SELECT a FROM ggg WHERE a IN (NULL, 'x'); @@ -11416,7 +11366,7 @@ EXPLAIN SELECT a FROM ggg WHERE a NOT IN (NULL, ''); ---------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..1.01 rows=1 width=2) -> Seq Scan on ggg (cost=0.00..1.01 rows=1 width=2) - Filter: a <> ALL ('{NULL,""}'::bpchar[]) + Filter: (a <> ALL ('{NULL,""}'::bpchar[])) Optimizer: Postgres query optimizer (4 rows) @@ -11426,9 +11376,8 @@ EXPLAIN SELECT a FROM ggg WHERE a IN (NULL, 'x'); Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..1.01 rows=1 width=2) -> Seq Scan on ggg (cost=0.00..1.01 rows=1 width=2) Filter: (a = ANY ('{NULL,x}'::bpchar[])) - Planning time: 0.038 ms Optimizer: Postgres query optimizer -(5 rows) +(4 rows) -- result node with one time filter and filter CREATE TABLE onetimefilter1 (a int, b int); @@ -11506,11 +11455,11 @@ WITH abc AS (SELECT onetimefilter1.a, onetimefilter1.b FROM onetimefilter1, onet ?column? | coalesce | b ----------+----------+---- 1 | 0 | 1 + 1 | 0 | 2 1 | 0 | 3 1 | 0 | 4 1 | 0 | 7 1 | 0 | 8 - 1 | 0 | 2 1 | 0 | 5 1 | 0 | 6 1 | 0 | 9 @@ -11565,12 +11514,12 @@ SELECT * FROM touter LEFT JOIN tinnerbitmap ON touter.a = tinnerbitmap.a; SELECT * FROM touter LEFT JOIN tinnerbitmap ON touter.a = tinnerbitmap.a AND tinnerbitmap.b=10; a | b | a | b ----+---+---+--- + 1 | 1 | | 2 | 2 | | 3 | 3 | | 4 | 4 | | 7 | 1 | | 8 | 2 | | - 1 | 1 | | 5 | 5 | | 6 | 0 | | 9 | 3 | | @@ -11596,15 +11545,15 @@ SELECT * FROM touter LEFT JOIN tinnerbtree ON touter.a = tinnerbtree.a AND tinne a | b | a | b ----+---+---+--- 1 | 1 | | - 5 | 5 | | - 6 | 0 | | - 9 | 3 | | - 10 | 4 | | 2 | 2 | | 3 | 3 | | 4 | 4 | | 7 | 1 | | 8 | 2 | | + 5 | 5 | | + 6 | 0 | | + 9 | 3 | | + 10 | 4 | | (10 rows) -- test subplan in a qual under dynamic scan @@ -11636,48 +11585,55 @@ SELECT * FROM ds_part, non_part2 WHERE ds_part.c = non_part2.e AND non_part2.f = (0 rows) explain analyze SELECT * FROM ds_part, non_part2 WHERE ds_part.c = non_part2.e AND non_part2.f = 10 AND a IN ( SELECT b + 1 FROM non_part1); - QUERY PLAN ---------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) (cost=10000000004.33..10000000039.13 rows=7 width=20) - -> Nested Loop Semi Join (cost=10000000004.33..10000000039.13 rows=3 width=20) - -> Hash Join (cost=4.33..28.40 rows=2 width=20) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- + Gather Motion 3:1 (slice3; segments: 3) (cost=10000000004.33..10000000039.13 rows=7 width=20) (actual time=2.817..2.817 rows=0 loops=1) + -> Nested Loop Semi Join (cost=10000000004.33..10000000039.13 rows=3 width=20) (never executed) + -> Hash Join (cost=4.33..28.40 rows=2 width=20) (never executed) Hash Cond: (ds_part_1_prt_deflt.c = non_part2.e) - -> Append (cost=0.00..24.00 rows=2 width=12) - -> Result (cost=0.00..17.87 rows=1 width=12) + -> Append (cost=0.00..24.00 rows=2 width=12) (never executed) + -> Result (cost=0.00..17.87 rows=1 width=12) (never executed) One-Time Filter: PartSelected - -> Seq Scan on ds_part_1_prt_deflt (cost=0.00..17.87 rows=1 width=12) + -> Seq Scan on ds_part_1_prt_deflt (cost=0.00..17.87 rows=1 width=12) (never executed) Filter: (a = (b + 1)) - -> Result (cost=0.00..2.03 rows=1 width=12) + -> Result (cost=0.00..2.03 rows=1 width=12) (never executed) One-Time Filter: PartSelected - -> Seq Scan on ds_part_1_prt_2 (cost=0.00..2.03 rows=1 width=12) + -> Seq Scan on ds_part_1_prt_2 (cost=0.00..2.03 rows=1 width=12) (never executed) Filter: (a = (b + 1)) - -> Result (cost=0.00..1.03 rows=1 width=12) + -> Result (cost=0.00..1.03 rows=1 width=12) (never executed) One-Time Filter: PartSelected - -> Seq Scan on ds_part_1_prt_3 (cost=0.00..1.03 rows=1 width=12) + -> Seq Scan on ds_part_1_prt_3 (cost=0.00..1.03 rows=1 width=12) (never executed) Filter: (a = (b + 1)) - -> Result (cost=0.00..1.03 rows=1 width=12) + -> Result (cost=0.00..1.03 rows=1 width=12) (never executed) One-Time Filter: PartSelected - -> Seq Scan on ds_part_1_prt_4 (cost=0.00..1.03 rows=1 width=12) + -> Seq Scan on ds_part_1_prt_4 (cost=0.00..1.03 rows=1 width=12) (never executed) Filter: (a = (b + 1)) - -> Result (cost=0.00..1.03 rows=1 width=12) + -> Result (cost=0.00..1.03 rows=1 width=12) (never executed) One-Time Filter: PartSelected - -> Seq Scan on ds_part_1_prt_5 (cost=0.00..1.03 rows=1 width=12) + -> Seq Scan on ds_part_1_prt_5 (cost=0.00..1.03 rows=1 width=12) (never executed) Filter: (a = (b + 1)) - -> Result (cost=0.00..1.01 rows=1 width=12) + -> Result (cost=0.00..1.01 rows=1 width=12) (never executed) One-Time Filter: PartSelected - -> Seq Scan on ds_part_1_prt_6 (cost=0.00..1.01 rows=1 width=12) + -> Seq Scan on ds_part_1_prt_6 (cost=0.00..1.01 rows=1 width=12) (never executed) Filter: (a = (b + 1)) - -> Hash (cost=4.29..4.29 rows=1 width=8) - -> Partition Selector for ds_part (dynamic scan id: 1) (cost=0.00..4.29 rows=1 width=8) + -> Hash (cost=4.29..4.29 rows=1 width=8) (actual time=0.021..0.021 rows=1 loops=1) + -> Partition Selector for ds_part (dynamic scan id: 1) (cost=0.00..4.29 rows=1 width=8) (actual time=0.019..0.019 rows=1 loops=1) Filter: non_part2.e - -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..4.29 rows=1 width=8) - -> Seq Scan on non_part2 (cost=0.00..4.25 rows=1 width=8) + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..4.29 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=1) + -> Seq Scan on non_part2 (cost=0.00..4.25 rows=1 width=8) (actual time=0.004..0.005 rows=1 loops=1) Filter: (f = 10) - -> Materialize (cost=0.00..9.50 rows=100 width=0) - -> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..8.00 rows=100 width=0) - -> Seq Scan on non_part1 (cost=0.00..4.00 rows=34 width=0) + -> Materialize (cost=0.00..9.50 rows=100 width=0) (actual time=1.557..1.557 rows=1 loops=1) + -> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..8.00 rows=100 width=0) (actual time=1.531..1.541 rows=100 loops=1) + -> Seq Scan on non_part1 (cost=0.00..4.00 rows=34 width=0) (actual time=0.003..0.008 rows=38 loops=1) + Planning time: 1.810 ms + (slice0) Executor memory: 284K bytes. + (slice1) Executor memory: 60K bytes avg x 3 workers, 60K bytes max (seg0). + (slice2) Executor memory: 60K bytes avg x 3 workers, 60K bytes max (seg0). + (slice3) Executor memory: 2384K bytes avg x 3 workers, 2384K bytes max (seg0). Work_mem: 1K bytes max. + Memory used: 128000kB Optimizer: Postgres query optimizer -(39 rows) + Execution time: 3.919 ms +(46 rows) SELECT *, a IN ( SELECT b + 1 FROM non_part1) FROM ds_part, non_part2 WHERE ds_part.c = non_part2.e AND non_part2.f = 10 AND a IN ( SELECT b FROM non_part1); a | b | c | e | f | ?column? @@ -11716,8 +11672,8 @@ EXPLAIN SELECT * FROM varchar_sc_array_cmp t1, varchar_sc_array_cmp t2 where t1. SELECT * FROM varchar_sc_array_cmp t1, varchar_sc_array_cmp t2 where t1.a = t2.a and t1.a in ('b', 'c'); a | a ---+--- - c | c b | b + c | c (2 rows) SET optimizer_array_constraints=on; @@ -11737,9 +11693,9 @@ EXPLAIN SELECT * FROM varchar_sc_array_cmp t1, varchar_sc_array_cmp t2 where t1. SELECT * FROM varchar_sc_array_cmp t1, varchar_sc_array_cmp t2 where t1.a = t2.a and (t1.a in ('b', 'c') OR t1.a = 'a'); a | a ---+--- - b | b a | a c | c + b | b (3 rows) DROP TABLE varchar_sc_array_cmp; @@ -11818,10 +11774,10 @@ insert into tt values (1, 'b'), (1, 'B'); select * from tc, tt where c = v; a | c | b | v ---+---+---+--- + 1 | b | 1 | b 1 | a | 1 | a 1 | A | 1 | A 1 | B | 1 | B - 1 | b | 1 | b (4 rows) -- test gpexpand phase 1 @@ -12025,12 +11981,12 @@ analyze part2_1_prt_2; explain select * from part1, part2 where part1.b = part2.b limit 5; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- - Limit (cost=410984.11..410984.89 rows=5 width=16) - -> Gather Motion 3:1 (slice1; segments: 3) (cost=410984.11..410984.89 rows=5 width=16) - -> Limit (cost=410984.11..410984.79 rows=2 width=16) + Limit (cost=7528.75..7529.53 rows=5 width=16) + -> Gather Motion 3:1 (slice3; segments: 3) (cost=7528.75..7529.53 rows=5 width=16) + -> Limit (cost=7528.75..7529.43 rows=2 width=16) -> Hash Join (cost=7528.75..4042082.35 rows=9947454 width=16) Hash Cond: (part1_1_prt_1.b = part2_1_prt_1.b) - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..5402.00 rows=57734 width=8) + -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..5402.00 rows=57734 width=8) Hash Key: part1_1_prt_1.b -> Append (cost=0.00..1938.00 rows=57734 width=8) -> Seq Scan on part1_1_prt_1 (cost=0.00..8.00 rows=167 width=8) @@ -12038,7 +11994,7 @@ explain select * from part1, part2 where part1.b = part2.b limit 5; -> Seq Scan on part1_1_prt_3 (cost=0.00..961.00 rows=28700 width=8) -> Seq Scan on part1_1_prt_4 (cost=0.00..961.00 rows=28700 width=8) -> Hash (cost=5375.00..5375.00 rows=57434 width=8) - -> Redistribute Motion 3:3 (slice3; segments: 3) (cost=0.00..5375.00 rows=57434 width=8) + -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..5375.00 rows=57434 width=8) Hash Key: part2_1_prt_1.b -> Append (cost=0.00..1929.00 rows=57434 width=8) -> Seq Scan on part2_1_prt_1 (cost=0.00..3.50 rows=17 width=8) @@ -12049,6 +12005,19 @@ explain select * from part1, part2 where part1.b = part2.b limit 5; (21 rows) -- test opfamily handling in ORCA +-- start_ignore +DROP FUNCTION abseq(int, int) CASCADE; +NOTICE: drop cascades to 4 other objects +DETAIL: drop cascades to operator |=|(integer,integer) +drop cascades to operator class abs_int_btree_ops for access method btree +drop cascades to operator class abs_int_hash_ops for access method hash +drop cascades to table abs_opclass_test +DROP FUNCTION abslt(int, int) CASCADE; +NOTICE: drop cascades to operator |<|(integer,integer) +DROP FUNCTION absgt(int, int) CASCADE; +NOTICE: drop cascades to operator |>|(integer,integer) +DROP FUNCTION abscmp(int, int) CASCADE; +-- end_ignore CREATE FUNCTION abseq(int, int) RETURNS BOOL AS $$ begin return abs($1) = abs($2); end; @@ -12106,7 +12075,7 @@ EXPLAIN SELECT a, b FROM atab_old_hash INNER JOIN btab_old_hash ON a |=| b; (8 rows) SELECT a, b FROM atab_old_hash INNER JOIN btab_old_hash ON a |=| b; -ERROR: could not find hash function for hash operator 73890 (nodeHash.c:389) (seg0 slice2 127.0.0.1:6002 pid=18942) (nodeHash.c:389) +ERROR: could not find hash function for hash operator 107857 (nodeHash.c:392) (seg0 slice2 127.0.1.1:6002 pid=663317) (nodeHash.c:392) CREATE OPERATOR CLASS abs_int_hash_ops FOR TYPE int4 USING hash AS OPERATOR 1 |=|, @@ -12137,11 +12106,11 @@ EXPLAIN SELECT a, b FROM atab_old_hash INNER JOIN btab_old_hash ON a |=| b; SELECT a, b FROM atab_old_hash INNER JOIN btab_old_hash ON a |=| b; a | b ----+---- + -1 | -1 + -1 | 1 0 | 0 - 1 | 1 1 | -1 - -1 | 1 - -1 | -1 + 1 | 1 (5 rows) EXPLAIN SELECT a, b FROM btab_old_hash LEFT OUTER JOIN atab_old_hash ON a |=| b; @@ -12164,11 +12133,11 @@ SELECT a, b FROM btab_old_hash LEFT OUTER JOIN atab_old_hash ON a |=| b; a | b ----+---- | 2 + -1 | 1 + -1 | -1 0 | 0 - 1 | -1 1 | 1 - -1 | -1 - -1 | 1 + 1 | -1 (6 rows) set optimizer_expand_fulljoin = on; @@ -12224,9 +12193,9 @@ set optimizer_join_order=query; -- we ignore enable/disable_xform statements as their output will differ if the server is compiled without Orca (the xform won't exist) -- start_ignore select disable_xform('CXformInnerJoin2HashJoin'); - disable_xform --------------------------------------- - CXformInnerJoin2HashJoin is disabled + disable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) -- end_ignore @@ -12259,9 +12228,9 @@ SELECT 1 FROM foo1, foo2 WHERE foo1.a = foo2.a AND foo2.c = 3 AND foo2.b IN (SEL reset optimizer_join_order; -- start_ignore select enable_xform('CXformInnerJoin2HashJoin'); - enable_xform -------------------------------------- - CXformInnerJoin2HashJoin is enabled + enable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) -- end_ignore @@ -12300,7 +12269,7 @@ HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sur -> Result (cost=0.00..0.01 rows=1 width=0) Output: '2020-01-01', '99' Optimizer: Postgres query optimizer - Settings: optimizer=off, optimizer_enable_dynamicbitmapscan=on, optimizer_join_order=query + Settings: optimizer_join_order=query (16 rows) CREATE TABLE TP AS @@ -12345,8 +12314,8 @@ explain select * from lossycastrangepart where b::int = 10; select * from lossycastrangepart where b::int = 10; a | b ------+------ - 10.1 | 10.1 9.9 | 9.9 + 10.1 | 10.1 (2 rows) explain select * from lossycastrangepart where b::int = 11; @@ -12368,8 +12337,8 @@ explain select * from lossycastrangepart where b::int = 11; select * from lossycastrangepart where b::int = 11; a | b ------+------ - 10.9 | 10.9 11.1 | 11.1 + 10.9 | 10.9 (2 rows) explain select * from lossycastrangepart where b::int < 10; @@ -12391,8 +12360,8 @@ explain select * from lossycastrangepart where b::int < 10; select * from lossycastrangepart where b::int < 10; a | b -----+----- - 5.1 | 5.1 9.1 | 9.1 + 5.1 | 5.1 (2 rows) explain select * from lossycastrangepart where b::int < 11; @@ -12415,9 +12384,9 @@ select * from lossycastrangepart where b::int < 11; a | b ------+------ 9.9 | 9.9 - 9.1 | 9.1 5.1 | 5.1 10.1 | 10.1 + 9.1 | 9.1 (4 rows) create table lossycastlistpart( a int, b float) partition by list(b) (partition l1 values(1.7, 2.1), partition l2 values(1.3, 2.7), partition l3 values(1.8, 2.8)); @@ -12569,7 +12538,7 @@ select * from tcorr1 out where out.b in (select coalesce(tcorr2.a, 99) from tcorr1 left outer join tcorr2 on tcorr1.a=tcorr2.a+out.a); -ERROR: Passing parameters across motion is not supported. (cdbmutate.c:3703) +ERROR: Passing parameters across motion is not supported. (cdbmutate.c:3712) -- expect 1 row -- FIXME: A process terminates during execution, see https://github.com/greenplum-db/gpdb/issues/10791 -- select * @@ -12663,7 +12632,7 @@ select * from tcorr1 out where out.b in (select coalesce(tcorr2.a, 99) from tcorr1 left outer join tcorr2 on tcorr1.a=tcorr2.a+out.a); -ERROR: Passing parameters across motion is not supported. (cdbmutate.c:3703) +ERROR: Passing parameters across motion is not supported. (cdbmutate.c:3712) -- expect 1 row -- FIXME: A process terminates during execution, see https://github.com/greenplum-db/gpdb/issues/10791 -- select * @@ -12831,13 +12800,13 @@ select * from foo join tbtree on foo.a=tbtree.a; 4000 | 4000 | 4000 | 4000 | 4000 | 4000 9000 | 9000 | 9000 | 9000 | 9000 | 9000 10000 | 10000 | 10000 | 10000 | 10000 | 10000 + 5000 | 5000 | 5000 | 5000 | 5000 | 5000 1000 | 1000 | 1000 | 1000 | 1000 | 1000 2000 | 2000 | 2000 | 2000 | 2000 | 2000 6000 | 6000 | 6000 | 6000 | 6000 | 6000 7000 | 7000 | 7000 | 7000 | 7000 | 7000 8000 | 8000 | 8000 | 8000 | 8000 | 8000 2000 | 2000 | 2000 | 2000 | -1 | -1 - 5000 | 5000 | 5000 | 5000 | 5000 | 5000 (11 rows) -- 2 simple bitmap @@ -12861,41 +12830,39 @@ select * from foo join tbitmap on foo.a=tbitmap.a; 4000 | 4000 | 4000 | 4000 | 4000 | 4000 9000 | 9000 | 9000 | 9000 | 9000 | 9000 10000 | 10000 | 10000 | 10000 | 10000 | 10000 - 5000 | 5000 | 5000 | 5000 | 5000 | 5000 1000 | 1000 | 1000 | 1000 | 1000 | 1000 2000 | 2000 | 2000 | 2000 | 2000 | 2000 6000 | 6000 | 6000 | 6000 | 6000 | 6000 7000 | 7000 | 7000 | 7000 | 7000 | 7000 8000 | 8000 | 8000 | 8000 | 8000 | 8000 2000 | 2000 | 2000 | 2000 | -1 | -1 + 5000 | 5000 | 5000 | 5000 | 5000 | 5000 (11 rows) -- 3 btree with select pred explain (costs off) select * from foo join tbtree on foo.a=tbtree.a where tbtree.a < 5000; - QUERY PLAN -------------------------------------------------- + QUERY PLAN +------------------------------------------ Gather Motion 3:1 (slice1; segments: 3) -> Hash Join Hash Cond: (tbtree.a = foo.a) - -> Bitmap Heap Scan on tbtree - Recheck Cond: (a < 5000) - -> Bitmap Index Scan on tbtreexa - Index Cond: (a < 5000) + -> Seq Scan on tbtree + Filter: (a < 5000) -> Hash -> Seq Scan on foo Filter: (a < 5000) Optimizer: Postgres query optimizer -(11 rows) +(9 rows) select * from foo join tbtree on foo.a=tbtree.a where tbtree.a < 5000; a | b | c | a | b | c ------+------+------+------+------+------ + 3000 | 3000 | 3000 | 3000 | 3000 | 3000 + 4000 | 4000 | 4000 | 4000 | 4000 | 4000 1000 | 1000 | 1000 | 1000 | 1000 | 1000 2000 | 2000 | 2000 | 2000 | 2000 | 2000 2000 | 2000 | 2000 | 2000 | -1 | -1 - 3000 | 3000 | 3000 | 3000 | 3000 | 3000 - 4000 | 4000 | 4000 | 4000 | 4000 | 4000 (5 rows) -- 4 bitmap with select pred @@ -12941,7 +12908,6 @@ select * from foo join (select a, b+c as bc from tbtree) proj on foo.a=proj.a; select * from foo join (select a, b+c as bc from tbtree) proj on foo.a=proj.a; a | b | c | a | bc -------+-------+-------+-------+------- - 5000 | 5000 | 5000 | 5000 | 10000 3000 | 3000 | 3000 | 3000 | 6000 4000 | 4000 | 4000 | 4000 | 8000 9000 | 9000 | 9000 | 9000 | 18000 @@ -12952,6 +12918,7 @@ select * from foo join (select a, b+c as bc from tbtree) proj on foo.a=proj.a; 7000 | 7000 | 7000 | 7000 | 14000 8000 | 8000 | 8000 | 8000 | 16000 2000 | 2000 | 2000 | 2000 | -2 + 5000 | 5000 | 5000 | 5000 | 10000 (11 rows) -- 6 bitmap with project @@ -12975,13 +12942,13 @@ select * from foo join (select a, b+c as bc from tbitmap) proj on foo.a=proj.a; 4000 | 4000 | 4000 | 4000 | 8000 9000 | 9000 | 9000 | 9000 | 18000 10000 | 10000 | 10000 | 10000 | 20000 - 5000 | 5000 | 5000 | 5000 | 10000 1000 | 1000 | 1000 | 1000 | 2000 2000 | 2000 | 2000 | 2000 | 4000 6000 | 6000 | 6000 | 6000 | 12000 7000 | 7000 | 7000 | 7000 | 14000 8000 | 8000 | 8000 | 8000 | 16000 2000 | 2000 | 2000 | 2000 | -2 + 5000 | 5000 | 5000 | 5000 | 10000 (11 rows) -- 7 btree with grby @@ -13036,44 +13003,42 @@ select * from foo join (select a, count(*) as cnt from tbitmap group by a) grby select * from foo join (select a, count(*) as cnt from tbitmap group by a) grby on foo.a=grby.a; a | b | c | a | cnt -------+-------+-------+-------+----- - 4000 | 4000 | 4000 | 4000 | 1 - 9000 | 9000 | 9000 | 9000 | 1 - 10000 | 10000 | 10000 | 10000 | 1 - 3000 | 3000 | 3000 | 3000 | 1 8000 | 8000 | 8000 | 8000 | 1 7000 | 7000 | 7000 | 7000 | 1 6000 | 6000 | 6000 | 6000 | 1 2000 | 2000 | 2000 | 2000 | 2 1000 | 1000 | 1000 | 1000 | 1 + 4000 | 4000 | 4000 | 4000 | 1 + 9000 | 9000 | 9000 | 9000 | 1 + 10000 | 10000 | 10000 | 10000 | 1 + 3000 | 3000 | 3000 | 3000 | 1 5000 | 5000 | 5000 | 5000 | 1 (10 rows) -- 9 btree with proj select grby select explain (costs off) select * from foo join (select a, count(*) + 5 as cnt from tbtree where tbtree.a < 5000 group by a having count(*) < 2) proj_sel_grby_sel on foo.a=proj_sel_grby_sel.a; - QUERY PLAN -------------------------------------------------------- + QUERY PLAN +------------------------------------------ Gather Motion 3:1 (slice1; segments: 3) -> Hash Join Hash Cond: (tbtree.a = foo.a) -> HashAggregate Group Key: tbtree.a Filter: (count(*) < 2) - -> Bitmap Heap Scan on tbtree - Recheck Cond: (a < 5000) - -> Bitmap Index Scan on tbtreexa - Index Cond: (a < 5000) + -> Seq Scan on tbtree + Filter: (a < 5000) -> Hash -> Seq Scan on foo Optimizer: Postgres query optimizer -(13 rows) +(11 rows) select * from foo join (select a, count(*) + 5 as cnt from tbtree where tbtree.a < 5000 group by a having count(*) < 2) proj_sel_grby_sel on foo.a=proj_sel_grby_sel.a; a | b | c | a | cnt ------+------+------+------+----- + 1000 | 1000 | 1000 | 1000 | 6 4000 | 4000 | 4000 | 4000 | 6 3000 | 3000 | 3000 | 3000 | 6 - 1000 | 1000 | 1000 | 1000 | 6 (3 rows) -- 10 bitmap with proj select grby select @@ -13097,9 +13062,9 @@ select * from foo join (select a, count(*) + 5 as cnt from tbitmap where tbitmap select * from foo join (select a, count(*) + 5 as cnt from tbitmap where tbitmap.a < 5000 group by a having count(*) < 2) proj_sel_grby_sel on foo.a=proj_sel_grby_sel.a; a | b | c | a | cnt ------+------+------+------+----- + 1000 | 1000 | 1000 | 1000 | 6 4000 | 4000 | 4000 | 4000 | 6 3000 | 3000 | 3000 | 3000 | 6 - 1000 | 1000 | 1000 | 1000 | 6 (3 rows) -- 11 bitmap with two groupbys @@ -13124,16 +13089,16 @@ select * from foo join (select a, count(*) as cnt from (select distinct a, b fro select * from foo join (select a, count(*) as cnt from (select distinct a, b from tbitmap) grby1 group by a) grby2 on foo.a=grby2.a; a | b | c | a | cnt -------+-------+-------+-------+----- - 9000 | 9000 | 9000 | 9000 | 1 - 10000 | 10000 | 10000 | 10000 | 1 - 4000 | 4000 | 4000 | 4000 | 1 - 3000 | 3000 | 3000 | 3000 | 1 5000 | 5000 | 5000 | 5000 | 1 2000 | 2000 | 2000 | 2000 | 2 7000 | 7000 | 7000 | 7000 | 1 1000 | 1000 | 1000 | 1000 | 1 8000 | 8000 | 8000 | 8000 | 1 6000 | 6000 | 6000 | 6000 | 1 + 9000 | 9000 | 9000 | 9000 | 1 + 10000 | 10000 | 10000 | 10000 | 1 + 4000 | 4000 | 4000 | 4000 | 1 + 3000 | 3000 | 3000 | 3000 | 1 (10 rows) -- 12 btree with proj select 2*grby select @@ -13141,8 +13106,8 @@ explain (costs off) select * from foo join (select a, count(*) + cnt1 as cnt2 from (select a, count(*) as cnt1 from tbtree group by a) grby1 where grby1.a < 5000 group by a, cnt1 having count(*) < 2) proj_sel_grby_sel on foo.a=proj_sel_grby_sel.a; - QUERY PLAN -------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) -> Hash Join Hash Cond: (proj_sel_grby_sel.a = foo.a) @@ -13152,24 +13117,22 @@ select * from foo join (select a, count(*) + cnt1 as cnt2 from (select a, count( Filter: (count(*) < 2) -> HashAggregate Group Key: tbtree.a - -> Bitmap Heap Scan on tbtree - Recheck Cond: (a < 5000) - -> Bitmap Index Scan on tbtreexa - Index Cond: (a < 5000) + -> Seq Scan on tbtree + Filter: (a < 5000) -> Hash -> Seq Scan on foo Optimizer: Postgres query optimizer -(16 rows) +(14 rows) select * from foo join (select a, count(*) + cnt1 as cnt2 from (select a, count(*) as cnt1 from tbtree group by a) grby1 where grby1.a < 5000 group by a, cnt1 having count(*) < 2) proj_sel_grby_sel on foo.a=proj_sel_grby_sel.a; a | b | c | a | cnt2 ------+------+------+------+------ - 2000 | 2000 | 2000 | 2000 | 3 - 1000 | 1000 | 1000 | 1000 | 2 4000 | 4000 | 4000 | 4000 | 2 3000 | 3000 | 3000 | 3000 | 2 + 2000 | 2000 | 2000 | 2000 | 3 + 1000 | 1000 | 1000 | 1000 | 2 (4 rows) -- 13 join pred accesses a projected column - no index scan @@ -13407,25 +13370,25 @@ explain (costs off) select * from tpart_dim d join tpart_ao_btree f on d.a=f.a w select disable_xform('CXformSelect2BitmapBoolOp'); disable_xform --------------------------------------- - CXformSelect2BitmapBoolOp is disabled + Server has been compiled without ORCA (1 row) select disable_xform('CXformSelect2DynamicBitmapBoolOp'); - disable_xform ----------------------------------------------- - CXformSelect2DynamicBitmapBoolOp is disabled + disable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) select disable_xform('CXformJoin2BitmapIndexGetApply'); - disable_xform --------------------------------------------- - CXformJoin2BitmapIndexGetApply is disabled + disable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) select disable_xform('CXformInnerJoin2NLJoin'); - disable_xform ------------------------------------- - CXformInnerJoin2NLJoin is disabled + disable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) -- Make sure we don't allow a regular (btree) index scan or index join for an AO table @@ -13468,27 +13431,27 @@ select * from tpart_dim d join tpart_ao_btree f on d.a=f.a where d.b=1; (1 row) select enable_xform('CXformSelect2BitmapBoolOp'); - enable_xform --------------------------------------- - CXformSelect2BitmapBoolOp is enabled + enable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) select enable_xform('CXformSelect2DynamicBitmapBoolOp'); - enable_xform ---------------------------------------------- - CXformSelect2DynamicBitmapBoolOp is enabled + enable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) select enable_xform('CXformJoin2BitmapIndexGetApply'); - enable_xform -------------------------------------------- - CXformJoin2BitmapIndexGetApply is enabled + enable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) select enable_xform('CXformInnerJoin2NLJoin'); - enable_xform ------------------------------------ - CXformInnerJoin2NLJoin is enabled + enable_xform +--------------------------------------- + Server has been compiled without ORCA (1 row) -- test casting with setops @@ -13596,8 +13559,7 @@ and first_id in (select first_id from mat_w); Output: material_test_1.first_id Filter: (material_test_1.second_id = ANY ('{1,2,3,4}'::integer[])) Optimizer: Postgres query optimizer - Settings: enable_seqscan=on, optimizer=off -(23 rows) +(22 rows) with mat_w as ( select first_id @@ -13610,14 +13572,14 @@ where first_id in (select first_id from mat_w) and first_id in (select first_id from mat_w); first_id ---------- + 1 + 1 2 3 4 2 3 4 - 1 - 1 (8 rows) reset optimizer_enable_indexscan; @@ -13659,8 +13621,7 @@ from mat m1 join mat m2 on m1.j = m2.j; -> Bitmap Index Scan on material_bitmapscan_idx (cost=0.00..102.66 rows=334 width=0) Index Cond: (material_bitmapscan_1.k = 'Thu Jun 03 00:00:00 2021'::timestamp without time zone) Optimizer: Postgres query optimizer - Settings: optimizer=off -(23 rows) +(22 rows) with mat as( select i, j from material_bitmapscan where i = 2 and j = 2 @@ -13713,16 +13674,16 @@ set enable_hashjoin=off; explain select r.a, r.b, r.c, l.c from left_outer_index_nl_foo r left outer join left_outer_index_nl_bar l on r.b=l.b; QUERY PLAN ---------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..5.58 rows=4 width=16) - -> Nested Loop Left Join (cost=0.00..5.58 rows=2 width=16) + Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..4.58 rows=4 width=16) + -> Nested Loop Left Join (cost=0.00..4.58 rows=2 width=16) Join Filter: (r.b = l.b) -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..2.12 rows=2 width=12) Hash Key: r.b -> Seq Scan on left_outer_index_nl_foo r (cost=0.00..2.04 rows=2 width=12) - -> Materialize (cost=0.00..3.17 rows=2 width=8) - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..3.15 rows=2 width=8) + -> Materialize (cost=0.00..2.17 rows=2 width=8) + -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..2.15 rows=2 width=8) Hash Key: l.b - -> Seq Scan on left_outer_index_nl_bar l (cost=0.00..3.05 rows=2 width=8) + -> Seq Scan on left_outer_index_nl_bar l (cost=0.00..2.05 rows=2 width=8) Optimizer: Postgres query optimizer (11 rows) @@ -13750,26 +13711,26 @@ analyze left_outer_index_nl_bar_hash; explain select r.a, r.b, r.c, l.c from left_outer_index_nl_foo_hash r left outer join left_outer_index_nl_bar l on r.b=l.b; QUERY PLAN ---------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..5.58 rows=4 width=14) - -> Nested Loop Left Join (cost=0.00..5.58 rows=2 width=14) + Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..4.58 rows=4 width=14) + -> Nested Loop Left Join (cost=0.00..4.58 rows=2 width=14) Join Filter: (r.b = l.b) -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..2.12 rows=2 width=10) Hash Key: r.b -> Seq Scan on left_outer_index_nl_foo_hash r (cost=0.00..2.04 rows=2 width=10) - -> Materialize (cost=0.00..3.17 rows=2 width=8) - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..3.15 rows=2 width=8) + -> Materialize (cost=0.00..2.17 rows=2 width=8) + -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..2.15 rows=2 width=8) Hash Key: l.b - -> Seq Scan on left_outer_index_nl_bar l (cost=0.00..3.05 rows=2 width=8) + -> Seq Scan on left_outer_index_nl_bar l (cost=0.00..2.05 rows=2 width=8) Optimizer: Postgres query optimizer (11 rows) select r.a, r.b, r.c, l.c from left_outer_index_nl_foo_hash r left outer join left_outer_index_nl_bar l on r.b=l.b; a | b | c | c ---+---+---+--- + 1 | 1 | 1 | 2 | 2 | 2 | 2 3 | 3 | 3 | 3 4 | 4 | 4 | 4 - 1 | 1 | 1 | (4 rows) --- verify that a motion is introduced such that joins on each segment are internal to that segment (distributed by join key) @@ -13868,13 +13829,13 @@ ANALYZE tt2; EXPLAIN SELECT b FROM tt1 WHERE NOT EXISTS (SELECT * FROM tt2 WHERE (tt2.d = tt1.b) IS DISTINCT FROM false); QUERY PLAN ------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice1; segments: 3) (cost=10000000000.00..10000000002.56 rows=3 width=4) - -> Nested Loop Anti Join (cost=10000000000.00..10000000002.52 rows=1 width=4) + Gather Motion 3:1 (slice2; segments: 3) (cost=10000000000.00..10000000005.06 rows=4 width=4) + -> Nested Loop Anti Join (cost=10000000000.00..10000000005.06 rows=2 width=4) Join Filter: ((tt2.d = tt1.b) IS DISTINCT FROM false) - -> Seq Scan on tt1 (cost=0.00..1.01 rows=1 width=4) - -> Materialize (cost=0.00..1.09 rows=4 width=4) - -> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..1.07 rows=4 width=4) - -> Seq Scan on tt2 (cost=0.00..1.01 rows=1 width=4) + -> Seq Scan on tt1 (cost=0.00..2.04 rows=2 width=4) + -> Materialize (cost=0.00..2.26 rows=4 width=4) + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..2.20 rows=4 width=4) + -> Seq Scan on tt2 (cost=0.00..2.04 rows=2 width=4) Optimizer: Postgres query optimizer (8 rows) @@ -13886,13 +13847,13 @@ SELECT b FROM tt1 WHERE NOT EXISTS (SELECT * FROM tt2 WHERE (tt2.d = tt1.b) IS D EXPLAIN SELECT b FROM tt1 WHERE NOT EXISTS (SELECT * FROM tt2 WHERE (tt2.d = tt1.b) IS DISTINCT FROM true); QUERY PLAN ------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice1; segments: 3) (cost=10000000000.00..10000000002.56 rows=3 width=4) - -> Nested Loop Anti Join (cost=10000000000.00..10000000002.52 rows=1 width=4) + Gather Motion 3:1 (slice2; segments: 3) (cost=10000000000.00..10000000005.06 rows=4 width=4) + -> Nested Loop Anti Join (cost=10000000000.00..10000000005.06 rows=2 width=4) Join Filter: ((tt2.d = tt1.b) IS DISTINCT FROM true) - -> Seq Scan on tt1 (cost=0.00..1.01 rows=1 width=4) - -> Materialize (cost=0.00..1.09 rows=4 width=4) - -> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..1.07 rows=4 width=4) - -> Seq Scan on tt2 (cost=0.00..1.01 rows=1 width=4) + -> Seq Scan on tt1 (cost=0.00..2.04 rows=2 width=4) + -> Materialize (cost=0.00..2.26 rows=4 width=4) + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..2.20 rows=4 width=4) + -> Seq Scan on tt2 (cost=0.00..2.04 rows=2 width=4) Optimizer: Postgres query optimizer (8 rows) @@ -13904,13 +13865,13 @@ SELECT b FROM tt1 WHERE NOT EXISTS (SELECT * FROM tt2 WHERE (tt2.d = tt1.b) IS D EXPLAIN SELECT b FROM tt1 WHERE NOT EXISTS (SELECT * FROM tt2 WHERE (tt1.b = tt2.d) IS DISTINCT FROM NULL); QUERY PLAN ------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice1; segments: 3) (cost=10000000000.00..10000000002.52 rows=3 width=4) - -> Nested Loop Anti Join (cost=10000000000.00..10000000002.47 rows=1 width=4) - Join Filter: ((tt1.b = tt2.d) IS NOT NULL) - -> Seq Scan on tt1 (cost=0.00..1.01 rows=1 width=4) - -> Materialize (cost=0.00..1.09 rows=4 width=4) - -> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..1.07 rows=4 width=4) - -> Seq Scan on tt2 (cost=0.00..1.01 rows=1 width=4) + Gather Motion 3:1 (slice2; segments: 3) (cost=10000000000.00..10000000005.06 rows=4 width=4) + -> Nested Loop Anti Join (cost=10000000000.00..10000000005.06 rows=2 width=4) + Join Filter: ((tt1.b = tt2.d) IS DISTINCT FROM NULL::boolean) + -> Seq Scan on tt1 (cost=0.00..2.04 rows=2 width=4) + -> Materialize (cost=0.00..2.26 rows=4 width=4) + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..2.20 rows=4 width=4) + -> Seq Scan on tt2 (cost=0.00..2.04 rows=2 width=4) Optimizer: Postgres query optimizer (8 rows) @@ -13963,16 +13924,16 @@ EXPLAIN (COSTS OFF) SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.a SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.a; a | b | c | a | b | c ----+----+----+----+----+---- - 5 | 5 | 5 | 5 | 5 | 5 - 6 | 6 | 6 | 6 | 6 | 6 - 9 | 9 | 9 | 9 | 9 | 9 - 10 | 10 | 10 | 10 | 10 | 10 2 | 2 | 2 | 2 | 2 | 2 3 | 3 | 3 | 3 | 3 | 3 4 | 4 | 4 | 4 | 4 | 4 7 | 7 | 7 | 7 | 7 | 7 8 | 8 | 8 | 8 | 8 | 8 1 | 1 | 1 | 1 | 1 | 1 + 5 | 5 | 5 | 5 | 5 | 5 + 6 | 6 | 6 | 6 | 6 | 6 + 9 | 9 | 9 | 9 | 9 | 9 + 10 | 10 | 10 | 10 | 10 | 10 (10 rows) --- if the inner child is not distributed on the join column, orca should @@ -14023,15 +13984,15 @@ EXPLAIN (COSTS OFF) SELECT * FROM tone t1 LEFT OUTER JOIN (SELECT 1+t2.b as b fr SELECT * FROM tone t1 LEFT OUTER JOIN (SELECT 1+t2.b as b from tone t2) t2 ON t1.a = t2.b; a | b | c | b ----+----+----+---- - 2 | 2 | 2 | 2 - 7 | 7 | 7 | 7 + 5 | 5 | 5 | 5 + 9 | 9 | 9 | 9 + 6 | 6 | 6 | 6 + 10 | 10 | 10 | 10 3 | 3 | 3 | 3 4 | 4 | 4 | 4 8 | 8 | 8 | 8 - 6 | 6 | 6 | 6 - 10 | 10 | 10 | 10 - 5 | 5 | 5 | 5 - 9 | 9 | 9 | 9 + 2 | 2 | 2 | 2 + 7 | 7 | 7 | 7 1 | 1 | 1 | (10 rows) @@ -14056,12 +14017,12 @@ SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.b+t2.a+1; 9 | 9 | 9 | 4 | 4 | 4 6 | 6 | 6 | | | 10 | 10 | 10 | | | - 1 | 1 | 1 | | | - 7 | 7 | 7 | 3 | 3 | 3 3 | 3 | 3 | 1 | 1 | 1 + 7 | 7 | 7 | 3 | 3 | 3 8 | 8 | 8 | | | 4 | 4 | 4 | | | 2 | 2 | 2 | | | + 1 | 1 | 1 | | | (10 rows) --- send a broadcast request to the inner child where the inner side clause contains @@ -14083,15 +14044,15 @@ SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.b-t1.a; a | b | c | a | b | c ----+----+----+----+----+---- 1 | 1 | 1 | 2 | 2 | 2 - 5 | 5 | 5 | 10 | 10 | 10 - 6 | 6 | 6 | | | - 9 | 9 | 9 | | | - 10 | 10 | 10 | | | 2 | 2 | 2 | 4 | 4 | 4 3 | 3 | 3 | 6 | 6 | 6 4 | 4 | 4 | 8 | 8 | 8 7 | 7 | 7 | | | 8 | 8 | 8 | | | + 5 | 5 | 5 | 10 | 10 | 10 + 6 | 6 | 6 | | | + 9 | 9 | 9 | | | + 10 | 10 | 10 | | | (10 rows) --- orca should broadcast the inner child if the guc is set off @@ -14113,7 +14074,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.b SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.b; a | b | c | a | b | c ----+----+----+----+----+---- - 1 | 1 | 1 | 1 | 1 | 1 2 | 2 | 2 | 2 | 2 | 2 3 | 3 | 3 | 3 | 3 | 3 4 | 4 | 4 | 4 | 4 | 4 @@ -14123,6 +14083,7 @@ SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.b; 6 | 6 | 6 | 6 | 6 | 6 9 | 9 | 9 | 9 | 9 | 9 10 | 10 | 10 | 10 | 10 | 10 + 1 | 1 | 1 | 1 | 1 | 1 (10 rows) EXPLAIN (COSTS OFF) SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.a; @@ -14140,15 +14101,15 @@ EXPLAIN (COSTS OFF) SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.a SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.a; a | b | c | a | b | c ----+----+----+----+----+---- - 5 | 5 | 5 | 5 | 5 | 5 - 6 | 6 | 6 | 6 | 6 | 6 - 9 | 9 | 9 | 9 | 9 | 9 - 10 | 10 | 10 | 10 | 10 | 10 2 | 2 | 2 | 2 | 2 | 2 3 | 3 | 3 | 3 | 3 | 3 4 | 4 | 4 | 4 | 4 | 4 7 | 7 | 7 | 7 | 7 | 7 8 | 8 | 8 | 8 | 8 | 8 + 5 | 5 | 5 | 5 | 5 | 5 + 6 | 6 | 6 | 6 | 6 | 6 + 9 | 9 | 9 | 9 | 9 | 9 + 10 | 10 | 10 | 10 | 10 | 10 1 | 1 | 1 | 1 | 1 | 1 (10 rows) @@ -14221,7 +14182,7 @@ select count(*) from (select trim( case when a!='abc' then (regexp_split_to_tab (1 row) select count(regexp_split_to_table((a)::text, ','::text)) from nested_srf; -ERROR: set-valued function called in context that cannot accept a set (seg2 slice1 127.0.0.1:6004 pid=17357) +ERROR: set-valued function called in context that cannot accept a set (seg2 slice1 127.0.1.1:6004 pid=663328) -- This produces wrong results on planner select count(*) from (select trim(coalesce(regexp_split_to_table((a)::text, ','::text),'')) from nested_srf)a; count @@ -14378,7 +14339,11 @@ select * from part_table13 where c=7; -- eval_const_expressions() call for subplan. ORCA has only one call to -- fold_constants() at the very beginning and doesn't perform folding later. CREATE TABLE join_null_rej1(i int); +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. +HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. CREATE TABLE join_null_rej2(i int); +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. +HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. INSERT INTO join_null_rej1(i) VALUES (1), (2), (3); INSERT INTO join_null_rej2 SELECT i FROM join_null_rej1; CREATE OR REPLACE FUNCTION join_null_rej_func() RETURNS int AS $$ @@ -14633,8 +14598,7 @@ explain verbose SELECT a IN (SELECT generate_series(1,a)) AS x FROM (SELECT gene -> Result (cost=0.00..5.01 rows=334 width=0) Output: generate_series(1, s.a) Optimizer: Postgres query optimizer - Settings: optimizer=off -(9 rows) +(8 rows) SELECT a IN (SELECT generate_series(1,a)) AS x FROM (SELECT generate_series(1, 3) AS a) AS s; x @@ -14663,8 +14627,7 @@ EXPLAIN (VERBOSE, COSTS OFF) -> Result Output: generate_series(1, "*VALUES*".column1) Optimizer: Postgres query optimizer - Settings: optimizer=off -(8 rows) +(7 rows) CREATE TABLE t_outer_srf (a int, b int) DISTRIBUTED BY (a); INSERT INTO t_outer_srf SELECT i, i+1 FROM generate_series(1,3) as i; @@ -14695,8 +14658,7 @@ EXPLAIN (VERBOSE, COSTS OFF) -> Broadcast Motion 3:3 (slice1; segments: 3) -> Seq Scan on orca.t_inner_srf Optimizer: Postgres query optimizer - Settings: optimizer=off -(14 rows) +(13 rows) DROP TABLE t_outer_srf, t_inner_srf; ------------------------------------------------------- @@ -14828,11 +14790,116 @@ explain (costs off) select (select b from subplan_test_1 where subplan_test_1.b= select (select b from subplan_test_1 where subplan_test_1.b=subplan_test_2.b) from subplan_test_2; b --- + 1 - 1 (5 rows) reset gp_max_slices; +-- start_ignore +DROP SCHEMA orca CASCADE; +NOTICE: drop cascades to 186 other objects +DETAIL: drop cascades to table bar1 +drop cascades to table bar2 +drop cascades to table r +drop cascades to table s +drop cascades to table m +drop cascades to table m1 +drop cascades to table orca_w1 +drop cascades to table orca_w2 +drop cascades to table orca_w3 +drop cascades to table rcte +drop cascades to table onek +drop cascades to table pp +drop cascades to table multilevel_p +drop cascades to table t +drop cascades to table t_date +drop cascades to table t_text +drop cascades to type employee +drop cascades to function emp_equal(employee,employee) +drop cascades to operator =(employee,employee) +drop cascades to operator family employee_op_class for access method btree +drop cascades to table t_employee +drop cascades to table t_ceeval_ints +drop cascades to function csq_f(integer) +drop cascades to table csq_r +drop cascades to table fooh1 +drop cascades to table fooh2 +drop cascades to append only table t77 +drop cascades to table prod9 +drop cascades to table toanalyze +drop cascades to table ur +drop cascades to table us +drop cascades to table ut +drop cascades to table uu +drop cascades to table twf1 +drop cascades to table twf2 +drop cascades to table tab1 +drop cascades to table tab2 +drop cascades to function sum_sfunc(anyelement,anyelement) +drop cascades to function sum_combinefunc(anyelement,anyelement) +drop cascades to function myagg1(anyelement) +drop cascades to function sum_sfunc2(anyelement,anyelement,anyelement) +drop cascades to function myagg2(anyelement,anyelement) +drop cascades to function gptfp(anyarray,anyelement) +drop cascades to function gpffp(anyarray) +drop cascades to function myagg3(anyelement) +drop cascades to table array_table +drop cascades to table mpp22453 +drop cascades to table mpp22791 +drop cascades to table p1 +drop cascades to append only table tmp_verd_s_pp_provtabs_agt_0015_extract1 +drop cascades to table arrtest +drop cascades to table foo_missing_stats +drop cascades to table bar_missing_stats +drop cascades to table table_with_small_statistic_precision_diff +drop cascades to table cust +drop cascades to table datedim +drop cascades to function plusone(integer) +drop cascades to table bm_test +drop cascades to table bm_dyn_test +drop cascades to table bm_dyn_test_onepart +drop cascades to table bm_dyn_test_multilvl_part +drop cascades to table my_tt_agg_opt +drop cascades to table my_tq_agg_opt_part +drop cascades to function plusone(numeric) +drop cascades to table ggg +drop cascades to table t3 +drop cascades to table index_test +drop cascades to table btree_test +drop cascades to table bitmap_test +drop cascades to type rainbow +drop cascades to table foo_ctas +drop cascades to table input_tab1 +drop cascades to table input_tab2 +drop cascades to table tab_1 +drop cascades to table tab_2 +drop cascades to table tab_3 +drop cascades to table t_outer +drop cascades to table t_inner +drop cascades to table wst0 +drop cascades to table wst1 +drop cascades to table wst2 +drop cascades to table test1 +drop cascades to table t_new +drop cascades to table x_tab +drop cascades to table y_tab +drop cascades to table z_tab +drop cascades to function test_func_pg_stats() +drop cascades to type myint +drop cascades to function myintout(myint) +drop cascades to function myintin(cstring) +drop cascades to function myint_int8(myint) +drop cascades to table csq_cast_param_outer +drop cascades to table csq_cast_param_inner +drop cascades to function myint_numeric(myint) +drop cascades to cast from myint to numeric +drop cascades to table onetimefilter1 +drop cascades to table onetimefilter2 +drop cascades to table ffoo +drop cascades to table fbar +drop cascades to table touter +and 86 other objects (see server log for list) +-- end_ignore diff --git a/src/test/regress/expected/vacuum_gp.out b/src/test/regress/expected/vacuum_gp.out index 576642885eb..95e80db5886 100644 --- a/src/test/regress/expected/vacuum_gp.out +++ b/src/test/regress/expected/vacuum_gp.out @@ -15,8 +15,6 @@ insert into ao_age_test select i, (i%123 > 50), (i/11) || '', '2008/10/12'::date + (i || ' days')::interval from generate_series(0, 99) i; create index ao_age_test_i on ao_age_test(i); -NOTICE: building index for child partition "ao_age_test_1_prt_b1" -NOTICE: building index for child partition "ao_age_test_1_prt_b2" -- MPP-23647 Create a empty table with no segments, let its age -- increase during the test. We will vacuum it at the end of the -- test. @@ -291,6 +289,8 @@ DROP ROLE r_priv_test; -- VACUUM and ANALYZE. set gp_autostats_mode='none'; CREATE TABLE vacuum_gp_pt (a int, b int) DISTRIBUTED BY (a) PARTITION BY range (b) (END(5), START(5)); +NOTICE: CREATE TABLE will create partition "vacuum_gp_pt_1_prt_1" for table "vacuum_gp_pt" +NOTICE: CREATE TABLE will create partition "vacuum_gp_pt_1_prt_2" for table "vacuum_gp_pt" INSERT INTO vacuum_gp_pt SELECT 0, 6 FROM generate_series(1, 12); SELECT relname, reltuples, relpages FROM pg_catalog.pg_class WHERE relname like 'vacuum_gp_pt%'; relname | reltuples | relpages @@ -338,12 +338,19 @@ WARNING: skipping "__gp_log_master_ext" --- cannot vacuum non-tables, external -- Vacuum related access control tests (Issue: https://github.com/greenplum-db/gpdb/issues/9001) -- Given a non-super-user role CREATE ROLE non_super_user_vacuum; +NOTICE: resource queue required -- using default resource queue "pg_default" -- And a heap table with auxiliary relations under the pg_toast namespace. CREATE TABLE vac_acl_heap(i int, j text); +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. +HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -- And an AO table with auxiliary relations under the pg_aoseg namespace. CREATE TABLE vac_acl_ao(i int, j text) with (appendonly=true); +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. +HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -- And an AOCS table with auxiliary relations under the pg_aocsseg namespace. CREATE TABLE vac_acl_aocs(i int, j text) with (appendonly=true, orientation=column); +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. +HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -- And all the tables belong to the non-super-user role. ALTER TABLE vac_acl_heap OWNER TO non_super_user_vacuum; ALTER TABLE vac_acl_ao OWNER TO non_super_user_vacuum; @@ -380,9 +387,9 @@ ORDER BY gp_segment_id; gp_segment_id | relname | reltuples | relpages | age ---------------+------------------------+-----------+----------+----- -1 | vacuum_test_heap_table | 10 | 3 | 3 - 0 | vacuum_test_heap_table | 0 | 0 | 4 - 1 | vacuum_test_heap_table | 0 | 0 | 4 - 2 | vacuum_test_heap_table | 0 | 0 | 4 + 0 | vacuum_test_heap_table | 5 | 1 | 4 + 1 | vacuum_test_heap_table | 1 | 1 | 4 + 2 | vacuum_test_heap_table | 4 | 1 | 4 (4 rows) VACUUM FREEZE vacuum_test_heap_table; From f0db4206425388e87524943b8d00bfdf923b9466 Mon Sep 17 00:00:00 2001 From: Victor Kremensky Date: Tue, 29 Jul 2025 06:26:03 +0000 Subject: [PATCH 4/5] Revert "changes in tests?" This reverts commit a08c31ee0cf297eb5f19d434b243090f8306b0f6. --- src/test/regress/expected/gporca.out | 5361 +++++++++++------------ src/test/regress/expected/vacuum_gp.out | 17 +- 2 files changed, 2652 insertions(+), 2726 deletions(-) diff --git a/src/test/regress/expected/gporca.out b/src/test/regress/expected/gporca.out index 0e54173c422..06c4155876f 100644 --- a/src/test/regress/expected/gporca.out +++ b/src/test/regress/expected/gporca.out @@ -18,13 +18,8 @@ set optimizer_segments = 3; set optimizer_enable_master_only_queries = on; -- master only tables create schema orca; --- start_ignore -GRANT ALL ON SCHEMA orca TO PUBLIC; -SET search_path to orca, public; --- end_ignore create table orca.r(); NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suitable for a distribution key. Creating a NULL policy entry. -WARNING: creating a table with no columns. set allow_system_table_mods=true; delete from gp_distribution_policy where localoid='orca.r'::regclass; reset allow_system_table_mods; @@ -33,7 +28,6 @@ alter table orca.r add column b int; insert into orca.r select i, i/3 from generate_series(1,20) i; create table orca.s(); NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suitable for a distribution key. Creating a NULL policy entry. -WARNING: creating a table with no columns. set allow_system_table_mods=true; delete from gp_distribution_policy where localoid='orca.s'::regclass; reset allow_system_table_mods; @@ -720,26 +714,26 @@ select count(*) from orca.r; select a, b from orca.r, orca.s group by a,b; a | b ----+--- - 12 | 4 - 5 | 1 - 8 | 2 - 3 | 1 13 | 4 + 9 | 3 + 5 | 1 + 16 | 5 + 12 | 4 + 17 | 5 4 | 1 - 19 | 6 - 15 | 5 + 18 | 6 10 | 3 - 2 | 0 + 8 | 2 6 | 2 + 15 | 5 + 19 | 6 14 | 4 - 16 | 5 - 18 | 6 - 1 | 0 + 3 | 1 + 2 | 0 11 | 3 7 | 2 - 9 | 3 20 | 6 - 17 | 5 + 1 | 0 (20 rows) select r.a+1 from orca.r; @@ -1909,23 +1903,23 @@ select pow(r.b,r.a) from orca.r; select b from orca.r group by b having count(*) > 2; b --- - 5 - 1 6 - 2 + 1 4 + 2 3 + 5 (6 rows) select b from orca.r group by b having count(*) <= avg(a) + (select count(*) from orca.s where s.c = r.b); b --- - 5 - 1 6 - 2 + 1 4 + 2 3 + 5 (6 rows) select sum(a) from orca.r group by b having count(*) > 2 order by b+1; @@ -2164,15 +2158,15 @@ insert into orca.bar2 select i,i+1,i+2 from generate_series(1,30) i; select x2 from orca.foo where x1 in (select x2 from orca.bar1); x2 ---- - 6 - 7 - 10 - 11 - 3 4 5 + 6 + 7 8 + 3 9 + 10 + 11 (9 rows) select 1; @@ -2238,46 +2232,46 @@ select distinct 1, sum(x1) from orca.foo; select distinct x1, rank() over(order by x1) from (select x1 from orca.foo order by x1) x; --order none x1 | rank ----+------ - 4 | 4 - 10 | 10 - 9 | 9 - 3 | 3 1 | 1 2 | 2 - 8 | 8 + 3 | 3 + 4 | 4 + 5 | 5 6 | 6 7 | 7 - 5 | 5 + 8 | 8 + 9 | 9 + 10 | 10 (10 rows) select distinct x1, sum(x3) from orca.foo group by x1,x2; x1 | sum ----+----- - 10 | 12 - 9 | 11 - 4 | 6 - 3 | 5 - 8 | 10 1 | 3 - 5 | 7 - 7 | 9 2 | 4 + 3 | 5 + 4 | 6 + 5 | 7 6 | 8 + 7 | 9 + 8 | 10 + 9 | 11 + 10 | 12 (10 rows) select distinct s from (select sum(x2) s from orca.foo group by x1) x; s ---- - 7 - 2 - 4 + 9 8 - 3 - 5 11 10 + 2 + 7 6 - 9 + 4 + 3 + 5 (10 rows) select * from orca.foo a where a.x1 = (select distinct sum(b.x1)+avg(b.x1) sa from orca.bar1 b group by b.x3 order by sa limit 1); @@ -2296,32 +2290,32 @@ select distinct a.x1 from orca.foo a where a.x1 <= (select distinct sum(b.x1)+av select * from orca.foo a where a.x1 = (select distinct b.x1 from orca.bar1 b where b.x1=a.x1 limit 1); x1 | x2 | x3 ----+----+---- - 5 | 6 | 7 - 6 | 7 | 8 - 9 | 10 | 11 - 10 | 11 | 12 1 | 2 | 3 2 | 3 | 4 + 8 | 9 | 10 + 9 | 10 | 11 + 10 | 11 | 12 3 | 4 | 5 4 | 5 | 6 + 5 | 6 | 7 + 6 | 7 | 8 7 | 8 | 9 - 8 | 9 | 10 (10 rows) -- with clause with cte1 as (select * from orca.foo) select a.x1+1 from (select * from cte1) a group by a.x1; ?column? ---------- - 8 + 2 3 + 8 + 7 5 - 9 4 6 - 11 - 7 10 - 2 + 9 + 11 (10 rows) select count(*)+1 from orca.bar1 b where b.x1 < any (with cte1 as (select * from orca.foo) select a.x1+1 from (select * from cte1) a group by a.x1); @@ -2396,12 +2390,12 @@ explain select case when bar1.x2 = bar2.x2 then coalesce((select 1 from orca.foo from orca.bar1 inner join orca.bar2 on (bar1.x2 = bar2.x2) order by bar1.x1; QUERY PLAN --------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice4; segments: 3) (cost=72.59..72.64 rows=20 width=12) + Gather Motion 3:1 (slice4; segments: 3) (cost=72.61..72.66 rows=20 width=12) Merge Key: bar1.x1 - -> Sort (cost=72.59..72.64 rows=7 width=12) + -> Sort (cost=72.61..72.66 rows=7 width=12) Sort Key: bar1.x1 - -> Hash Join (cost=3.85..72.16 rows=7 width=12) - Hash Cond: (bar2.x2 = bar1.x2) + -> Hash Join (cost=3.85..72.17 rows=7 width=12) + Hash Cond: bar2.x2 = bar1.x2 -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..3.90 rows=10 width=4) Hash Key: bar2.x2 -> Seq Scan on bar2 (cost=0.00..3.30 rows=10 width=4) @@ -2409,16 +2403,17 @@ from orca.bar1 inner join orca.bar2 on (bar1.x2 = bar2.x2) order by bar1.x1; -> Redistribute Motion 3:3 (slice3; segments: 3) (cost=0.00..3.60 rows=7 width=8) Hash Key: bar1.x2 -> Seq Scan on bar1 (cost=0.00..3.20 rows=7 width=8) - SubPlan 1 (slice4; segments: 3) + SubPlan 1 -> Result (cost=0.00..3.20 rows=1 width=0) - One-Time Filter: (bar1.x2 = bar2.x2) - -> Result (cost=0.00..3.21 rows=1 width=0) - Filter: ((foo.x2 = bar2.x2) AND ((bar1.x2)::double precision = random())) - -> Materialize (cost=0.00..3.21 rows=1 width=0) + One-Time Filter: $0 = $1 + -> Result (cost=3.20..3.21 rows=1 width=0) + Filter: foo.x2 = $1 AND $0::double precision = random() + -> Materialize (cost=3.20..3.21 rows=1 width=0) -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..3.20 rows=1 width=0) -> Seq Scan on foo (cost=0.00..3.20 rows=1 width=0) - Optimizer: Postgres query optimizer -(22 rows) + Settings: optimizer=off; optimizer_segments=3 + Optimizer status: Postgres query optimizer +(23 rows) select case when bar1.x2 = bar2.x2 then coalesce((select 1 from orca.foo where bar1.x2 = bar2.x2 and bar1.x2 = random() and foo.x2 = bar2.x2),0) else 1 end as col1, bar1.x1 from orca.bar1 inner join orca.bar2 on (bar1.x2 = bar2.x2) order by bar1.x1; @@ -2460,713 +2455,648 @@ select * from orca.r, orca.s where r.a=s.c; a | b | c | d ---+---+---+--- 1 | 1 | 1 | 1 + 2 | 2 | 2 | 0 1 | 1 | 1 | 0 + 2 | 2 | 2 | 1 1 | 1 | 1 | 1 + 2 | 2 | 2 | 0 1 | 1 | 1 | 0 + 2 | 2 | 2 | 1 1 | 1 | 1 | 1 - 5 | 2 | 5 | 1 - 6 | 0 | 6 | 0 - 5 | 2 | 5 | 0 - 6 | 0 | 6 | 1 - 5 | 2 | 5 | 1 - 6 | 0 | 6 | 0 - 5 | 2 | 5 | 0 - 6 | 0 | 6 | 1 2 | 2 | 2 | 0 3 | 0 | 3 | 1 4 | 1 | 4 | 0 - 2 | 2 | 2 | 1 + 5 | 2 | 5 | 1 + 6 | 0 | 6 | 0 3 | 0 | 3 | 0 4 | 1 | 4 | 1 - 2 | 2 | 2 | 0 + 5 | 2 | 5 | 0 + 6 | 0 | 6 | 1 3 | 0 | 3 | 1 4 | 1 | 4 | 0 - 2 | 2 | 2 | 1 + 5 | 2 | 5 | 1 + 6 | 0 | 6 | 0 3 | 0 | 3 | 0 4 | 1 | 4 | 1 - 2 | 2 | 2 | 0 + 5 | 2 | 5 | 0 + 6 | 0 | 6 | 1 (26 rows) -- Materialize node select * from orca.r, orca.s where r.as.c; a | b | c | d ----+---+---+--- - 1 | 1 | 2 | 0 - 12 | 0 | 2 | 0 - 15 | 0 | 2 | 0 - 20 | 2 | 2 | 0 - 2 | 2 | 2 | 0 - 3 | 0 | 2 | 0 - 4 | 1 | 2 | 0 - 7 | 1 | 2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0 - 19 | 1 - 19 | 1 - 19 | 1 - 19 | 1 - 19 | 1 - 1 | 1 - 1 | 1 - 1 | 1 - 1 | 1 - 1 | 1 - 12 | 0 - 12 | 0 - 12 | 0 - 12 | 0 - 12 | 0 - 15 | 0 - 15 | 0 - 15 | 0 - 15 | 0 - 15 | 0 - 20 | 2 - 20 | 2 - 20 | 2 - 20 | 2 - 20 | 2 - 5 | 2 - 5 | 2 - 5 | 2 - 5 | 2 - 5 | 2 - 6 | 0 - 6 | 0 - 6 | 0 - 6 | 0 - 6 | 0 9 | 0 9 | 0 9 | 0 @@ -3182,6 +3112,21 @@ select r.* from orca.r, orca.s where s.c=2; 11 | 2 11 | 2 11 | 2 + 12 | 0 + 12 | 0 + 12 | 0 + 12 | 0 + 12 | 0 + 1 | 1 + 1 | 1 + 1 | 1 + 1 | 1 + 1 | 1 + 2 | 2 + 2 | 2 + 2 | 2 + 2 | 2 + 2 | 2 13 | 1 13 | 1 13 | 1 @@ -3192,21 +3137,69 @@ select r.* from orca.r, orca.s where s.c=2; 14 | 2 14 | 2 14 | 2 + 15 | 0 + 15 | 0 + 15 | 0 + 15 | 0 + 15 | 0 + 16 | 1 + 16 | 1 + 16 | 1 + 16 | 1 + 16 | 1 17 | 2 17 | 2 17 | 2 17 | 2 17 | 2 + 3 | 0 + 3 | 0 + 3 | 0 + 3 | 0 + 3 | 0 + 4 | 1 + 4 | 1 + 4 | 1 + 4 | 1 + 4 | 1 + 5 | 2 + 5 | 2 + 5 | 2 + 5 | 2 + 5 | 2 + 6 | 0 + 6 | 0 + 6 | 0 + 6 | 0 + 6 | 0 + 7 | 1 + 7 | 1 + 7 | 1 + 7 | 1 + 7 | 1 + 18 | 0 + 18 | 0 + 18 | 0 + 18 | 0 + 18 | 0 + 19 | 1 + 19 | 1 + 19 | 1 + 19 | 1 + 19 | 1 + 20 | 2 + 20 | 2 + 20 | 2 + 20 | 2 + 20 | 2 (100 rows) create table orca.m(); NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suitable for a distribution key. Creating a NULL policy entry. -WARNING: creating a table with no columns. alter table orca.m add column a int; alter table orca.m add column b int; create table orca.m1(); NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suitable for a distribution key. Creating a NULL policy entry. -WARNING: creating a table with no columns. alter table orca.m1 add column a int; alter table orca.m1 add column b int; insert into orca.m select i-1, i%2 from generate_series(1,35) i; @@ -3221,42 +3214,42 @@ select r.a, s.c from orca.r left outer join orca.s on(r.a=s.c); 1 | 1 1 | 1 1 | 1 - 20 | - 15 | - 12 | - 5 | 5 - 6 | 6 - 5 | 5 - 6 | 6 - 5 | 5 - 6 | 6 - 5 | 5 - 6 | 6 + 2 | 2 + 2 | 2 + 2 | 2 + 2 | 2 + 2 | 2 13 | 14 | - 11 | - 10 | - 9 | + 15 | + 16 | 17 | - 2 | 2 + 8 | + 9 | + 10 | + 11 | + 12 | 3 | 3 - 4 | 4 - 2 | 2 3 | 3 - 4 | 4 - 2 | 2 3 | 3 - 4 | 4 - 2 | 2 3 | 3 4 | 4 - 2 | 2 - | - 18 | + 4 | 4 + 4 | 4 + 4 | 4 + 5 | 5 + 5 | 5 + 5 | 5 + 5 | 5 + 6 | 6 + 6 | 6 + 6 | 6 + 6 | 6 7 | - 16 | - 8 | + 18 | 19 | + 20 | + | (41 rows) select r.a, s.c from orca.r left outer join orca.s on(r.a=s.c and r.a=r.b and s.c=s.d) order by r.a,s.c; @@ -3310,34 +3303,34 @@ select r.a, s.c from orca.r left outer join orca.s on(r.a=s.c) where s.d > 2 or select r.a, s.c from orca.r right outer join orca.s on(r.a=s.c); a | c ---+--- - 2 | 2 - 3 | 3 - 4 | 4 - 2 | 2 - 3 | 3 - 4 | 4 - 2 | 2 - 3 | 3 - 4 | 4 - 2 | 2 - 3 | 3 - 4 | 4 - 2 | 2 1 | 1 + 2 | 2 | 0 1 | 1 + 2 | 2 | 0 1 | 1 + 2 | 2 | 0 1 | 1 + 2 | 2 | 0 1 | 1 + 2 | 2 + 3 | 3 + 4 | 4 5 | 5 6 | 6 + 3 | 3 + 4 | 4 5 | 5 6 | 6 + 3 | 3 + 4 | 4 5 | 5 6 | 6 + 3 | 3 + 4 | 4 5 | 5 6 | 6 (30 rows) @@ -3345,98 +3338,98 @@ select r.a, s.c from orca.r right outer join orca.s on(r.a=s.c); select * from orca.r where exists (select * from orca.s where s.c=r.a + 2); a | b ---+--- + 1 | 1 + 2 | 2 3 | 0 4 | 1 - 2 | 2 - 1 | 1 (4 rows) select * from orca.r where exists (select * from orca.s where s.c=r.b); a | b ----+--- - 20 | 2 - 5 | 2 - 11 | 2 - 14 | 2 - 17 | 2 - 2 | 2 - 8 | 2 1 | 1 - 12 | 0 - 15 | 0 - 6 | 0 - 9 | 0 - 10 | 1 + 2 | 2 13 | 1 + 14 | 2 + 15 | 0 + 16 | 1 + 17 | 2 3 | 0 4 | 1 + 5 | 2 + 6 | 0 7 | 1 - 16 | 1 18 | 0 19 | 1 + 20 | 2 | 1 + 8 | 2 + 9 | 0 + 10 | 1 + 11 | 2 + 12 | 0 (21 rows) select * from orca.m where m.a not in (select a from orca.m1 where a=5); a | b ----+--- + 0 | 1 1 | 0 + 3 | 0 + 4 | 1 + 8 | 1 + 9 | 0 + 15 | 0 + 23 | 0 + 30 | 1 2 | 1 6 | 1 7 | 0 - 8 | 1 10 | 1 - 12 | 1 + 11 | 0 13 | 0 - 15 | 0 16 | 1 + 17 | 0 + 18 | 1 + 20 | 1 21 | 0 22 | 1 + 24 | 1 26 | 1 27 | 0 - 29 | 0 - 3 | 0 - 4 | 1 - 9 | 0 - 19 | 0 - 20 | 1 - 23 | 0 - 24 | 1 - 28 | 1 - 30 | 1 31 | 0 32 | 1 - 33 | 0 - 0 | 1 - 11 | 0 + 12 | 1 14 | 1 - 17 | 0 - 18 | 1 + 19 | 0 25 | 0 + 28 | 1 + 29 | 0 + 33 | 0 34 | 1 (34 rows) select * from orca.m where m.a not in (select a from orca.m1); a | b ----+--- - 26 | 1 - 27 | 0 - 29 | 0 + 30 | 1 25 | 0 + 28 | 1 + 29 | 0 + 33 | 0 34 | 1 24 | 1 - 28 | 1 - 30 | 1 + 26 | 1 + 27 | 0 31 | 0 32 | 1 - 33 | 0 (11 rows) select * from orca.m where m.a in (select a from orca.m1 where m1.a-1 = m.b); a | b ---+--- - 1 | 0 2 | 1 + 1 | 0 (2 rows) -- enable_hashjoin=off; enable_mergejoin=on @@ -3465,25 +3458,25 @@ select 1 from orca.m, orca.m1 where m.a = m1.a and m.b!=m1.b; select * from orca.r left outer join orca.s on (r.a=s.c and r.b Nested Loop (cost=10000000000.00..10000000031.55 rows=11 width=16) - Join Filter: (NOT (r.a IS DISTINCT FROM s.c)) - -> Seq Scan on s (cost=0.00..3.30 rows=10 width=8) + Gather Motion 3:1 (slice2; segments: 3) (cost=10000000000.00..10000000030.55 rows=31 width=16) + -> Nested Loop (cost=10000000000.00..10000000030.55 rows=11 width=16) + Join Filter: NOT r.a IS DISTINCT FROM s.c + -> Seq Scan on s (cost=0.00..2.30 rows=10 width=8) -> Materialize (cost=0.00..4.30 rows=20 width=8) -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..4.00 rows=20 width=8) -> Seq Scan on r (cost=0.00..3.20 rows=7 width=8) @@ -3505,16 +3498,17 @@ explain select * from orca.r, orca.s where r.a is not distinct from s.c; -- explain Hash Join with equality join condition -- force_explain explain select * from orca.r, orca.s where r.a = s.c; - QUERY PLAN + QUERY PLAN ------------------------------------------------------------------------------ - Gather Motion 3:1 (slice1; segments: 3) (cost=3.45..7.16 rows=30 width=16) - -> Hash Join (cost=3.45..7.16 rows=10 width=16) - Hash Cond: (s.c = r.a) - -> Seq Scan on s (cost=0.00..3.30 rows=10 width=8) + Gather Motion 3:1 (slice1; segments: 3) (cost=3.45..6.20 rows=30 width=16) + -> Hash Join (cost=3.45..6.20 rows=10 width=16) + Hash Cond: s.c = r.a + -> Seq Scan on s (cost=0.00..2.30 rows=10 width=8) -> Hash (cost=3.20..3.20 rows=7 width=8) -> Seq Scan on r (cost=0.00..3.20 rows=7 width=8) - Optimizer: Postgres query optimizer -(7 rows) + Settings: optimizer=off; optimizer_segments=3 + Optimizer status: Postgres query optimizer +(8 rows) -- sort select * from orca.r join orca.s on(r.a=s.c) order by r.a, s.d; @@ -3641,231 +3635,230 @@ insert into orca.m values (1,-1), (1,2), (1,1); select a,a,a+b from orca.m; a | a | ?column? ----+----+---------- - 1 | 1 | 1 - 2 | 2 | 3 - 6 | 6 | 7 - 7 | 7 | 7 - 8 | 8 | 9 - 10 | 10 | 11 12 | 12 | 13 - 13 | 13 | 13 - 15 | 15 | 15 - 16 | 16 | 17 - 21 | 21 | 21 - 22 | 22 | 23 - 26 | 26 | 27 - 27 | 27 | 27 + 14 | 14 | 15 + 19 | 19 | 19 + 25 | 25 | 25 + 28 | 28 | 29 29 | 29 | 29 - 1 | 1 | 3 + 33 | 33 | 33 + 34 | 34 | 35 + 1 | 1 | 0 + 0 | 0 | 1 + 1 | 1 | 1 3 | 3 | 3 4 | 4 | 5 + 8 | 8 | 9 9 | 9 | 9 - 19 | 19 | 19 - 20 | 20 | 21 - 23 | 23 | 23 - 24 | 24 | 25 - 28 | 28 | 29 + 15 | 15 | 15 + 23 | 23 | 23 30 | 30 | 31 - 31 | 31 | 31 - 32 | 32 | 33 - 33 | 33 | 33 - 1 | 1 | 0 1 | 1 | 2 - 0 | 0 | 1 + 2 | 2 | 3 5 | 5 | 5 + 6 | 6 | 7 + 7 | 7 | 7 + 10 | 10 | 11 11 | 11 | 11 - 14 | 14 | 15 + 13 | 13 | 13 + 16 | 16 | 17 17 | 17 | 17 18 | 18 | 19 - 25 | 25 | 25 - 34 | 34 | 35 + 20 | 20 | 21 + 21 | 21 | 21 + 22 | 22 | 23 + 24 | 24 | 25 + 26 | 26 | 27 + 27 | 27 | 27 + 31 | 31 | 31 + 32 | 32 | 33 + 1 | 1 | 3 (38 rows) select a,a+b,a+b from orca.m; a | ?column? | ?column? ----+----------+---------- - 0 | 1 | 1 - 5 | 5 | 5 - 11 | 11 | 11 + 12 | 13 | 13 14 | 15 | 15 - 17 | 17 | 17 - 18 | 19 | 19 + 19 | 19 | 19 25 | 25 | 25 + 28 | 29 | 29 + 29 | 29 | 29 + 33 | 33 | 33 34 | 35 | 35 + 1 | 0 | 0 + 0 | 1 | 1 1 | 1 | 1 + 3 | 3 | 3 + 4 | 5 | 5 + 8 | 9 | 9 + 9 | 9 | 9 + 15 | 15 | 15 + 23 | 23 | 23 + 30 | 31 | 31 + 1 | 2 | 2 2 | 3 | 3 + 5 | 5 | 5 6 | 7 | 7 7 | 7 | 7 - 8 | 9 | 9 10 | 11 | 11 - 12 | 13 | 13 + 11 | 11 | 11 13 | 13 | 13 - 15 | 15 | 15 16 | 17 | 17 + 17 | 17 | 17 + 18 | 19 | 19 + 20 | 21 | 21 21 | 21 | 21 22 | 23 | 23 + 24 | 25 | 25 26 | 27 | 27 27 | 27 | 27 - 29 | 29 | 29 - 1 | 3 | 3 - 3 | 3 | 3 - 4 | 5 | 5 - 9 | 9 | 9 - 19 | 19 | 19 - 20 | 21 | 21 - 23 | 23 | 23 - 24 | 25 | 25 - 28 | 29 | 29 - 30 | 31 | 31 31 | 31 | 31 32 | 33 | 33 - 33 | 33 | 33 - 1 | 0 | 0 - 1 | 2 | 2 + 1 | 3 | 3 (38 rows) -- func expr select * from orca.m where a=abs(b); a | b ---+---- - 1 | -1 1 | 1 + 1 | -1 (2 rows) -- grouping sets select a,b,count(*) from orca.m group by grouping sets ((a), (a,b)); a | b | count ----+----+------- - 0 | 1 | 1 - 13 | 0 | 1 - 34 | | 1 - 33 | 0 | 1 - 19 | 0 | 1 - 20 | | 1 - 29 | | 1 - 16 | | 1 - 25 | | 1 - 15 | | 1 - 1 | 0 | 1 - 18 | 1 | 1 + 13 | | 1 + 12 | | 1 + 24 | 1 | 1 + 16 | 1 | 1 6 | 1 | 1 - 25 | 0 | 1 - 22 | 1 | 1 - 18 | | 1 - 29 | 0 | 1 - 8 | 1 | 1 - 19 | | 1 - 32 | 1 | 1 - 23 | 0 | 1 - 4 | 1 | 1 - 24 | | 1 + 14 | | 1 + 20 | 1 | 1 2 | 1 | 1 - 12 | | 1 - 5 | | 1 - 4 | | 1 - 1 | 1 | 1 - 33 | | 1 - 26 | | 1 - 28 | | 1 + 16 | | 1 + 31 | 0 | 1 27 | 0 | 1 + 13 | 0 | 1 + 9 | 0 | 1 17 | | 1 - 34 | 1 | 1 - 23 | | 1 - 1 | 2 | 1 - 12 | 1 | 1 - 21 | | 1 - 7 | | 1 + 32 | | 1 + 17 | 0 | 1 3 | | 1 - 31 | 0 | 1 + 34 | 1 | 1 + 19 | | 1 + 11 | | 1 + 9 | | 1 + 31 | | 1 + 28 | 1 | 1 10 | 1 | 1 - 32 | | 1 - 7 | 0 | 1 + 18 | 1 | 1 + 21 | 0 | 1 8 | | 1 + 32 | 1 | 1 + 25 | 0 | 1 + 29 | 0 | 1 0 | | 1 - 30 | | 1 - 20 | 1 | 1 - 13 | | 1 - 24 | 1 | 1 - 1 | -1 | 1 - 1 | | 4 - 16 | 1 | 1 - 31 | | 1 + 18 | | 1 + 2 | | 1 14 | 1 | 1 - 26 | 1 | 1 - 5 | 0 | 1 - 9 | | 1 + 7 | 0 | 1 + 30 | | 1 + 27 | | 1 + 5 | | 1 + 3 | 0 | 1 11 | 0 | 1 - 6 | | 1 - 14 | | 1 - 28 | 1 | 1 - 15 | 0 | 1 - 11 | | 1 - 21 | 0 | 1 - 9 | 0 | 1 + 0 | 1 | 1 + 26 | | 1 + 4 | | 1 + 34 | | 1 + 22 | 1 | 1 + 1 | -1 | 1 + 28 | | 1 + 19 | 0 | 1 + 1 | 2 | 1 10 | | 1 + 23 | | 1 + 1 | 1 | 1 + 15 | | 1 + 8 | 1 | 1 30 | 1 | 1 - 27 | | 1 + 25 | | 1 + 21 | | 1 + 33 | | 1 + 12 | 1 | 1 + 20 | | 1 + 24 | | 1 + 1 | | 4 + 15 | 0 | 1 + 6 | | 1 + 29 | | 1 + 7 | | 1 + 1 | 0 | 1 + 5 | 0 | 1 + 26 | 1 | 1 + 4 | 1 | 1 + 33 | 0 | 1 22 | | 1 - 17 | 0 | 1 - 3 | 0 | 1 - 2 | | 1 + 23 | 0 | 1 (73 rows) select b,count(*) from orca.m group by grouping sets ((a), (a,b)); b | count ----+------- + | 1 1 | 1 - 0 | 1 + -1 | 1 | 1 0 | 1 - 0 | 1 + 2 | 1 | 1 | 1 + 1 | 1 + | 1 + 1 | 1 + 1 | 1 | 1 | 1 | 1 - 0 | 1 - 1 | 1 1 | 1 + | 1 + | 1 + | 4 0 | 1 | 1 - 1 | 1 + | 1 | 1 0 | 1 - 1 | 1 - 1 | 1 0 | 1 1 | 1 - | 1 1 | 1 + 0 | 1 | 1 + 0 | 1 | 1 | 1 1 | 1 - | 1 - | 1 - | 1 - | 1 - 0 | 1 1 | 1 - | 1 - 2 | 1 1 | 1 | 1 + 1 | 1 + 1 | 1 | 1 - | 1 0 | 1 + 0 | 1 + 0 | 1 + 0 | 1 + | 1 1 | 1 | 1 0 | 1 | 1 | 1 | 1 - 1 | 1 - 1 | 1 - -1 | 1 | 1 - | 4 | 1 1 | 1 1 | 1 @@ -3873,221 +3866,222 @@ select b,count(*) from orca.m group by grouping sets ((a), (a,b)); 0 | 1 | 1 0 | 1 - | 1 - | 1 1 | 1 0 | 1 | 1 - 0 | 1 + 1 | 1 + | 1 + | 1 0 | 1 | 1 - 1 | 1 | 1 | 1 0 | 1 0 | 1 + 1 | 1 + | 1 | 1 (73 rows) select a,count(*) from orca.m group by grouping sets ((a), (a,b)); a | count ----+------- - 0 | 1 - 13 | 1 - 34 | 1 - 33 | 1 - 19 | 1 - 20 | 1 - 29 | 1 - 25 | 1 - 16 | 1 - 15 | 1 - 1 | 1 - 18 | 1 - 6 | 1 - 25 | 1 + 11 | 1 + 9 | 1 + 31 | 1 + 28 | 1 + 10 | 1 18 | 1 - 22 | 1 - 29 | 1 + 21 | 1 8 | 1 - 19 | 1 32 | 1 - 23 | 1 - 4 | 1 - 24 | 1 + 25 | 1 + 29 | 1 + 0 | 1 + 18 | 1 2 | 1 - 12 | 1 + 14 | 1 + 7 | 1 + 30 | 1 + 27 | 1 5 | 1 + 3 | 1 + 11 | 1 + 0 | 1 + 26 | 1 4 | 1 + 22 | 1 + 34 | 1 + 1 | 1 1 | 1 - 33 | 1 - 26 | 1 28 | 1 - 27 | 1 - 17 | 1 - 34 | 1 + 19 | 1 + 10 | 1 23 | 1 1 | 1 - 12 | 1 - 21 | 1 - 7 | 1 - 3 | 1 - 31 | 1 - 10 | 1 - 32 | 1 - 7 | 1 + 15 | 1 8 | 1 - 0 | 1 30 | 1 + 21 | 1 + 25 | 1 + 33 | 1 20 | 1 - 13 | 1 + 12 | 1 24 | 1 - 1 | 1 1 | 4 - 16 | 1 - 31 | 1 - 14 | 1 - 26 | 1 + 15 | 1 + 6 | 1 + 7 | 1 + 29 | 1 + 1 | 1 5 | 1 - 9 | 1 - 11 | 1 + 26 | 1 + 4 | 1 + 33 | 1 + 22 | 1 + 23 | 1 + 13 | 1 + 12 | 1 + 24 | 1 + 16 | 1 6 | 1 14 | 1 - 28 | 1 - 15 | 1 - 11 | 1 - 21 | 1 - 9 | 1 - 10 | 1 - 30 | 1 + 20 | 1 + 2 | 1 + 16 | 1 + 31 | 1 27 | 1 - 22 | 1 + 13 | 1 + 9 | 1 + 17 | 1 + 32 | 1 17 | 1 + 34 | 1 3 | 1 - 2 | 1 + 19 | 1 (73 rows) select a,count(*) from orca.m group by grouping sets ((a), (b)); a | count ----+------- - 34 | 1 - 20 | 1 - 29 | 1 - 16 | 1 - 25 | 1 - 15 | 1 + 11 | 1 + 9 | 1 + 31 | 1 + 8 | 1 + | 19 + 0 | 1 18 | 1 - 19 | 1 - | 1 - 24 | 1 - 12 | 1 + 2 | 1 + 30 | 1 + 27 | 1 5 | 1 4 | 1 - 33 | 1 26 | 1 + 34 | 1 + | 1 28 | 1 - 17 | 1 - | 19 + 10 | 1 23 | 1 + 15 | 1 + | 1 + 25 | 1 21 | 1 - 7 | 1 - 3 | 1 - 32 | 1 - | 17 - 8 | 1 - 0 | 1 - 30 | 1 - 13 | 1 + 33 | 1 + 20 | 1 + 24 | 1 1 | 4 - 31 | 1 - 9 | 1 + | 17 6 | 1 - 14 | 1 - 11 | 1 - 10 | 1 - | 1 - 27 | 1 + 29 | 1 + 7 | 1 22 | 1 - 2 | 1 + 13 | 1 + 12 | 1 + 14 | 1 + 16 | 1 + 17 | 1 + 32 | 1 + 3 | 1 + 19 | 1 (39 rows) select a,b,count(*) from orca.m group by rollup(a, b); a | b | count ----+----+------- - 0 | 1 | 1 - 13 | 0 | 1 + 22 | 1 | 1 34 | | 1 - 33 | 0 | 1 + 1 | -1 | 1 + 1 | 2 | 1 + 28 | | 1 19 | 0 | 1 + 10 | | 1 + 23 | | 1 + 1 | 1 | 1 + 15 | | 1 + 8 | 1 | 1 + 30 | 1 | 1 + 21 | | 1 + 25 | | 1 + 33 | | 1 20 | | 1 + 12 | 1 | 1 + 24 | | 1 + 1 | | 4 + 15 | 0 | 1 + 6 | | 1 + 7 | | 1 29 | | 1 - 16 | | 1 - 25 | | 1 - 15 | | 1 1 | 0 | 1 - 18 | 1 | 1 - 6 | 1 | 1 - | | 38 - 25 | 0 | 1 - 22 | 1 | 1 - 18 | | 1 - 19 | | 1 - 29 | 0 | 1 - 8 | 1 | 1 - 32 | 1 | 1 - 23 | 0 | 1 + 5 | 0 | 1 + 26 | 1 | 1 4 | 1 | 1 - 24 | | 1 - 2 | 1 | 1 + 33 | 0 | 1 + 22 | | 1 + 23 | 0 | 1 + 13 | | 1 12 | | 1 - 5 | | 1 - 4 | | 1 - 1 | 1 | 1 - 33 | | 1 - 26 | | 1 - 28 | | 1 + 24 | 1 | 1 + 16 | 1 | 1 + 6 | 1 | 1 + 14 | | 1 + 20 | 1 | 1 + 2 | 1 | 1 + 16 | | 1 + 31 | 0 | 1 27 | 0 | 1 + 13 | 0 | 1 + 9 | 0 | 1 17 | | 1 - 34 | 1 | 1 - 23 | | 1 - 1 | 2 | 1 - 12 | 1 | 1 - 21 | | 1 - 7 | | 1 + 32 | | 1 + 17 | 0 | 1 3 | | 1 - 31 | 0 | 1 + 34 | 1 | 1 + 19 | | 1 + 11 | | 1 + 9 | | 1 + 31 | | 1 + 28 | 1 | 1 10 | 1 | 1 - 32 | | 1 - 7 | 0 | 1 + 18 | 1 | 1 + 21 | 0 | 1 8 | | 1 + 32 | 1 | 1 + 25 | 0 | 1 + 29 | 0 | 1 0 | | 1 - 30 | | 1 - 20 | 1 | 1 - 13 | | 1 - 24 | 1 | 1 - 1 | -1 | 1 - 1 | | 4 - 16 | 1 | 1 - 31 | | 1 + 18 | | 1 + 2 | | 1 14 | 1 | 1 - 26 | 1 | 1 - 5 | 0 | 1 - 9 | | 1 - 11 | 0 | 1 - 6 | | 1 - 14 | | 1 - 28 | 1 | 1 - 15 | 0 | 1 - 11 | | 1 - 21 | 0 | 1 - 9 | 0 | 1 - 10 | | 1 - 30 | 1 | 1 + 7 | 0 | 1 + 30 | | 1 27 | | 1 - 22 | | 1 - 17 | 0 | 1 + 5 | | 1 3 | 0 | 1 - 2 | | 1 + | | 38 + 11 | 0 | 1 + 0 | 1 | 1 + 26 | | 1 + 4 | | 1 (74 rows) select a,b,count(*) from orca.m group by rollup((a),(a,b)) order by 1,2,3; @@ -4178,54 +4172,54 @@ select count(*) from orca.m group by (); select a, count(*) from orca.r group by (), a; a | count ----+------- + 14 | 1 + 16 | 1 + 17 | 1 + 1 | 1 + 15 | 1 + 2 | 1 + 13 | 1 + 7 | 1 19 | 1 18 | 1 - 7 | 1 - 2 | 1 - 4 | 1 - 8 | 1 - 16 | 1 | 1 - 3 | 1 + 6 | 1 + 4 | 1 20 | 1 - 1 | 1 - 12 | 1 - 15 | 1 + 3 | 1 5 | 1 - 13 | 1 + 9 | 1 + 12 | 1 + 8 | 1 11 | 1 10 | 1 - 17 | 1 - 6 | 1 - 14 | 1 - 9 | 1 (21 rows) select a, count(*) from orca.r group by grouping sets ((),(a)); a | count ----+------- - 3 | 1 + 14 | 1 + 5 | 1 9 | 1 - 6 | 1 10 | 1 - 5 | 1 - 16 | 1 - | 21 - 14 | 1 + 19 | 1 + 18 | 1 + 1 | 1 20 | 1 + | 21 7 | 1 - 18 | 1 - 13 | 1 + 16 | 1 15 | 1 + 11 | 1 + 2 | 1 + 6 | 1 + | 1 17 | 1 + 4 | 1 8 | 1 - 1 | 1 - | 1 - 11 | 1 + 3 | 1 12 | 1 - 19 | 1 - 4 | 1 - 2 | 1 + 13 | 1 (22 rows) select a, b, count(*) c from orca.r group by grouping sets ((),(a), (a,b)) order by b,a,c; @@ -4333,27 +4327,27 @@ select 1 from orca.r group by (); select a,1 from orca.r group by rollup(a); a | ?column? ----+---------- - 3 | 1 + 1 | 1 5 | 1 - 6 | 1 9 | 1 10 | 1 - 16 | 1 - | 1 - 7 | 1 - 8 | 1 - 13 | 1 14 | 1 - 15 | 1 - 17 | 1 18 | 1 - 20 | 1 - 1 | 1 + 19 | 1 2 | 1 - 4 | 1 + 6 | 1 + 7 | 1 11 | 1 + 15 | 1 + 16 | 1 + 20 | 1 + | 1 + 3 | 1 + 4 | 1 + 8 | 1 12 | 1 - 19 | 1 + 13 | 1 + 17 | 1 | 1 (22 rows) @@ -4361,205 +4355,205 @@ select a,1 from orca.r group by rollup(a); select array[array[a,b]], array[b] from orca.r; array | array ------------+------- + {{1,1}} | {1} {{2,2}} | {2} + {{13,1}} | {1} + {{14,2}} | {2} + {{15,0}} | {0} + {{16,1}} | {1} + {{17,2}} | {2} {{3,0}} | {0} {{4,1}} | {1} + {{5,2}} | {2} + {{6,0}} | {0} {{7,1}} | {1} - {{8,2}} | {2} - {{16,1}} | {1} {{18,0}} | {0} {{19,1}} | {1} - {{NULL,1}} | {1} - {{1,1}} | {1} - {{12,0}} | {0} - {{15,0}} | {0} {{20,2}} | {2} - {{5,2}} | {2} - {{6,0}} | {0} + {{NULL,1}} | {1} + {{8,2}} | {2} {{9,0}} | {0} {{10,1}} | {1} {{11,2}} | {2} - {{13,1}} | {1} - {{14,2}} | {2} - {{17,2}} | {2} + {{12,0}} | {0} (21 rows) -- setops select a, b from orca.m union select b,a from orca.m; a | b ----+---- - 22 | 1 - 1 | 26 - 1 | 34 - -1 | 1 - 32 | 1 - 1 | 16 - 4 | 1 - 13 | 0 + 0 | 1 0 | 13 - 29 | 0 - 2 | 1 - 0 | 19 - 0 | 31 - 1 | 14 - 19 | 0 + 0 | 15 + 0 | 27 0 | 29 - 1 | 22 - 0 | 1 - 33 | 0 - 23 | 0 - 8 | 1 - 6 | 1 + 0 | 31 + 1 | 8 + 1 | 10 + 1 | 12 + 1 | 24 + 1 | 26 1 | 32 - 1 | 18 - 1 | 0 + 3 | 0 + 7 | 0 + 10 | 1 + 11 | 0 + 14 | 1 18 | 1 - 0 | 27 + 21 | 0 25 | 0 - 1 | 2 - 1 | 12 - 34 | 1 - 12 | 1 - 0 | 9 - 24 | 1 - 1 | 10 - 1 | 1 - 16 | 1 - 1 | 20 - 20 | 1 - 0 | 25 - 27 | 0 - 0 | 21 - 1 | 30 - 31 | 0 + 28 | 1 + 29 | 0 + 32 | 1 + 0 | 3 0 | 5 - 10 | 1 - 1 | 6 - 7 | 0 - 1 | -1 - 11 | 0 - 1 | 4 - 3 | 0 0 | 17 + 0 | 19 + 0 | 21 + 0 | 33 + 1 | -1 + 1 | 0 + 1 | 1 + 1 | 2 + 1 | 14 + 1 | 16 + 1 | 28 + 1 | 30 + 1 | 34 + 4 | 1 5 | 0 - 0 | 7 + 8 | 1 + 12 | 1 15 | 0 - 1 | 28 - 1 | 8 + 19 | 0 + 22 | 1 + 23 | 0 + 26 | 1 30 | 1 + 33 | 0 + -1 | 1 + 0 | 7 + 0 | 9 0 | 11 - 0 | 3 - 21 | 0 - 0 | 15 - 14 | 1 - 26 | 1 - 1 | 24 0 | 23 + 0 | 25 + 1 | 4 + 1 | 6 + 1 | 18 + 1 | 20 + 1 | 22 + 2 | 1 + 6 | 1 9 | 0 + 13 | 0 + 16 | 1 17 | 0 - 0 | 33 - 28 | 1 + 20 | 1 + 24 | 1 + 27 | 0 + 31 | 0 + 34 | 1 (71 rows) SELECT a from orca.m UNION ALL select b from orca.m UNION ALL select a+b from orca.m group by 1; a ---- - 1 - 2 - 6 - 7 - 8 - 10 12 - 13 + 14 + 19 + 25 + 28 + 29 + 33 + 34 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 1 + -1 + 35 + 31 + 17 + 1 15 - 16 - 21 - 22 - 26 - 27 + 33 + 2 + 0 + 13 29 - 1 0 + 1 + 3 + 4 + 8 + 9 + 15 + 23 + 30 1 1 0 - 1 + 0 1 1 0 0 - 1 0 1 1 - 0 - 0 - 2 - 19 - 27 - 2 7 - 29 + 19 + 21 3 - 0 5 - 11 - 14 - 17 - 18 - 25 - 34 - 1 - 0 - 0 - 1 - 0 - 1 - 0 - 1 + 2 5 - 13 - 33 + 6 + 7 + 10 11 + 13 + 16 17 - 21 - 25 - 9 - 3 - 4 - 9 - 19 + 18 20 - 23 + 21 + 22 24 - 28 - 30 + 26 + 27 31 32 - 33 1 1 0 1 0 - 0 1 0 + 0 1 + 0 1 1 0 1 - 0 - -1 1 - 23 - 35 1 - 31 0 - 15 + 0 + 1 + 2 + 9 + 27 + 11 + 23 + 25 (96 rows) drop table if exists orca.foo; @@ -4577,421 +4571,421 @@ insert into orca.bar select i, i%3, i%2 from generate_series(1,30)i; SELECT distinct a, b from orca.foo; a | b ----+--- - 23 | 1 - 12 | 0 - 1 | 1 - 38 | 0 - 35 | 1 - 20 | 0 - 40 | 0 - 26 | 0 + 16 | 0 15 | 1 - 31 | 1 - 36 | 0 + 33 | 1 + 13 | 1 30 | 0 - 27 | 1 - 3 | 1 - 22 | 0 - 18 | 0 - 7 | 1 + 17 | 1 34 | 0 - 29 | 1 - 4 | 0 - 24 | 0 - 2 | 0 - 19 | 1 - 39 | 1 - 16 | 0 + 36 | 0 + 35 | 1 + 31 | 1 37 | 1 - 8 | 0 + 29 | 1 28 | 0 + 2 | 0 + 1 | 1 + 14 | 0 5 | 1 6 | 0 - 17 | 1 - 13 | 1 - 32 | 0 + 7 | 1 + 4 | 0 + 22 | 0 + 18 | 0 21 | 1 + 19 | 1 + 38 | 0 + 40 | 0 + 39 | 1 + 20 | 0 + 3 | 1 + 27 | 1 + 24 | 0 + 12 | 0 + 8 | 0 25 | 1 + 23 | 1 10 | 0 - 33 | 1 - 14 | 0 11 | 1 + 32 | 0 + 26 | 0 9 | 1 (40 rows) SELECT distinct foo.a, bar.b from orca.foo, orca.bar where foo.b = bar.a; a | b ----+--- - 23 | 1 - 3 | 1 + 5 | 1 33 | 1 - 11 | 1 - 31 | 1 + 19 | 1 + 37 | 1 + 23 | 1 + 1 | 1 9 | 1 - 5 | 1 - 27 | 1 + 15 | 1 7 | 1 35 | 1 - 21 | 1 - 19 | 1 - 15 | 1 - 17 | 1 - 13 | 1 - 29 | 1 - 1 | 1 - 25 | 1 39 | 1 - 37 | 1 + 25 | 1 + 29 | 1 + 11 | 1 + 27 | 1 + 13 | 1 + 17 | 1 + 21 | 1 + 31 | 1 + 3 | 1 (20 rows) SELECT distinct a, b from orca.foo; a | b ----+--- + 16 | 0 + 15 | 1 + 33 | 1 + 13 | 1 + 30 | 0 + 17 | 1 + 34 | 0 + 36 | 0 + 35 | 1 + 31 | 1 + 37 | 1 + 29 | 1 28 | 0 + 2 | 0 + 1 | 1 + 14 | 0 5 | 1 6 | 0 - 17 | 1 - 13 | 1 - 32 | 0 - 21 | 1 - 25 | 1 - 10 | 0 - 33 | 1 - 14 | 0 - 11 | 1 - 9 | 1 - 27 | 1 - 3 | 1 - 22 | 0 - 18 | 0 7 | 1 - 34 | 0 - 29 | 1 4 | 0 - 24 | 0 - 2 | 0 + 22 | 0 + 18 | 0 + 21 | 1 19 | 1 + 38 | 0 + 40 | 0 39 | 1 - 16 | 0 - 37 | 1 + 20 | 0 + 3 | 1 + 27 | 1 + 24 | 0 + 12 | 0 8 | 0 + 25 | 1 23 | 1 - 12 | 0 - 1 | 1 - 38 | 0 - 35 | 1 - 20 | 0 - 40 | 0 + 10 | 0 + 11 | 1 + 32 | 0 26 | 0 - 15 | 1 - 31 | 1 - 36 | 0 - 30 | 0 + 9 | 1 (40 rows) SELECT distinct a, count(*) from orca.foo group by a; a | count ----+------- - 34 | 1 - 12 | 1 - 24 | 1 - 17 | 1 - 13 | 1 - 29 | 1 1 | 1 - 16 | 1 - 20 | 1 - 25 | 1 - 36 | 1 - 39 | 1 - 10 | 1 - 37 | 1 - 22 | 1 - 5 | 1 - 27 | 1 - 32 | 1 + 2 | 1 + 3 | 1 4 | 1 + 5 | 1 + 6 | 1 7 | 1 - 35 | 1 - 21 | 1 - 40 | 1 - 2 | 1 - 19 | 1 + 8 | 1 + 9 | 1 + 10 | 1 + 11 | 1 + 12 | 1 + 13 | 1 + 14 | 1 15 | 1 - 8 | 1 - 6 | 1 + 16 | 1 + 17 | 1 18 | 1 - 38 | 1 + 19 | 1 + 20 | 1 + 21 | 1 + 22 | 1 23 | 1 - 3 | 1 - 30 | 1 - 14 | 1 + 24 | 1 + 25 | 1 26 | 1 - 33 | 1 - 11 | 1 - 31 | 1 - 9 | 1 + 27 | 1 28 | 1 + 29 | 1 + 30 | 1 + 31 | 1 + 32 | 1 + 33 | 1 + 34 | 1 + 35 | 1 + 36 | 1 + 37 | 1 + 38 | 1 + 39 | 1 + 40 | 1 (40 rows) SELECT distinct foo.a, bar.b, sum(bar.c+foo.c) from orca.foo, orca.bar where foo.b = bar.a group by foo.a, bar.b; a | b | sum ----+---+----- - 15 | 1 | 4 - 11 | 1 | 4 + 1 | 1 | 2 + 3 | 1 | 4 5 | 1 | 2 - 33 | 1 | 2 - 31 | 1 | 4 - 37 | 1 | 2 - 29 | 1 | 2 + 7 | 1 | 4 + 9 | 1 | 2 + 11 | 1 | 4 13 | 1 | 2 - 21 | 1 | 2 - 3 | 1 | 4 + 15 | 1 | 4 17 | 1 | 2 + 19 | 1 | 4 + 21 | 1 | 2 + 23 | 1 | 4 25 | 1 | 2 - 7 | 1 | 4 27 | 1 | 4 - 9 | 1 | 2 - 39 | 1 | 4 - 1 | 1 | 2 + 29 | 1 | 2 + 31 | 1 | 4 + 33 | 1 | 2 35 | 1 | 4 - 19 | 1 | 4 - 23 | 1 | 4 + 37 | 1 | 2 + 39 | 1 | 4 (20 rows) SELECT distinct a, count(*) from orca.foo group by a; a | count ----+------- - 22 | 1 - 5 | 1 - 27 | 1 - 32 | 1 + 1 | 1 + 2 | 1 + 3 | 1 4 | 1 + 5 | 1 + 6 | 1 7 | 1 - 35 | 1 - 21 | 1 - 40 | 1 - 2 | 1 - 19 | 1 - 15 | 1 8 | 1 - 6 | 1 - 38 | 1 - 18 | 1 - 34 | 1 + 9 | 1 + 10 | 1 + 11 | 1 12 | 1 - 24 | 1 - 17 | 1 13 | 1 - 1 | 1 - 29 | 1 - 20 | 1 + 14 | 1 + 15 | 1 16 | 1 - 25 | 1 - 36 | 1 - 39 | 1 - 10 | 1 - 37 | 1 + 17 | 1 + 18 | 1 + 19 | 1 + 20 | 1 + 21 | 1 + 22 | 1 23 | 1 - 3 | 1 - 30 | 1 - 14 | 1 + 24 | 1 + 25 | 1 26 | 1 - 33 | 1 - 11 | 1 - 31 | 1 - 9 | 1 + 27 | 1 28 | 1 + 29 | 1 + 30 | 1 + 31 | 1 + 32 | 1 + 33 | 1 + 34 | 1 + 35 | 1 + 36 | 1 + 37 | 1 + 38 | 1 + 39 | 1 + 40 | 1 (40 rows) SELECT distinct foo.a, bar.b from orca.foo, orca.bar where foo.b = bar.a; a | b ----+--- - 5 | 1 - 27 | 1 + 15 | 1 7 | 1 35 | 1 - 21 | 1 - 19 | 1 - 15 | 1 - 17 | 1 - 13 | 1 - 29 | 1 - 1 | 1 - 25 | 1 39 | 1 + 25 | 1 + 29 | 1 + 11 | 1 + 5 | 1 + 33 | 1 + 19 | 1 37 | 1 23 | 1 - 3 | 1 - 33 | 1 - 11 | 1 - 31 | 1 + 1 | 1 9 | 1 + 27 | 1 + 13 | 1 + 17 | 1 + 21 | 1 + 31 | 1 + 3 | 1 (20 rows) SELECT distinct foo.a, bar.b, sum(bar.c+foo.c) from orca.foo, orca.bar where foo.b = bar.a group by foo.a, bar.b; a | b | sum ----+---+----- - 9 | 1 | 2 - 39 | 1 | 4 1 | 1 | 2 - 35 | 1 | 4 - 19 | 1 | 4 - 23 | 1 | 4 - 29 | 1 | 2 - 13 | 1 | 2 - 21 | 1 | 2 3 | 1 | 4 + 5 | 1 | 2 + 7 | 1 | 4 + 9 | 1 | 2 + 11 | 1 | 4 + 13 | 1 | 2 + 15 | 1 | 4 17 | 1 | 2 + 19 | 1 | 4 + 21 | 1 | 2 + 23 | 1 | 4 25 | 1 | 2 - 7 | 1 | 4 27 | 1 | 4 - 15 | 1 | 4 - 11 | 1 | 4 - 5 | 1 | 2 - 33 | 1 | 2 + 29 | 1 | 2 31 | 1 | 4 + 33 | 1 | 2 + 35 | 1 | 4 37 | 1 | 2 + 39 | 1 | 4 (20 rows) SELECT distinct a, b from orca.foo; a | b ----+--- - 27 | 1 - 3 | 1 - 22 | 0 - 18 | 0 - 7 | 1 - 34 | 0 - 29 | 1 - 4 | 0 - 24 | 0 - 2 | 0 - 19 | 1 - 39 | 1 16 | 0 - 37 | 1 - 8 | 0 - 23 | 1 - 12 | 0 - 1 | 1 - 38 | 0 - 35 | 1 - 20 | 0 - 40 | 0 - 26 | 0 15 | 1 - 31 | 1 - 36 | 0 + 33 | 1 + 13 | 1 30 | 0 + 17 | 1 + 34 | 0 + 36 | 0 + 35 | 1 + 31 | 1 + 37 | 1 + 29 | 1 28 | 0 + 2 | 0 + 1 | 1 + 14 | 0 5 | 1 6 | 0 - 17 | 1 - 13 | 1 - 32 | 0 + 7 | 1 + 4 | 0 + 22 | 0 + 18 | 0 21 | 1 + 19 | 1 + 38 | 0 + 40 | 0 + 39 | 1 + 20 | 0 + 3 | 1 + 27 | 1 + 24 | 0 + 12 | 0 + 8 | 0 25 | 1 + 23 | 1 10 | 0 - 33 | 1 - 14 | 0 11 | 1 + 32 | 0 + 26 | 0 9 | 1 (40 rows) -SELECT distinct a, count(*) from orca.foo group by a; - a | count -----+------- - 22 | 1 - 5 | 1 - 27 | 1 - 32 | 1 - 4 | 1 - 7 | 1 - 35 | 1 - 21 | 1 - 40 | 1 - 2 | 1 - 19 | 1 - 15 | 1 - 8 | 1 - 6 | 1 - 38 | 1 - 18 | 1 - 23 | 1 +SELECT distinct a, count(*) from orca.foo group by a; + a | count +----+------- + 1 | 1 + 2 | 1 3 | 1 - 30 | 1 - 14 | 1 - 26 | 1 - 33 | 1 - 11 | 1 - 31 | 1 + 4 | 1 + 5 | 1 + 6 | 1 + 7 | 1 + 8 | 1 9 | 1 - 28 | 1 - 34 | 1 + 10 | 1 + 11 | 1 12 | 1 - 24 | 1 - 17 | 1 13 | 1 - 1 | 1 - 29 | 1 - 20 | 1 + 14 | 1 + 15 | 1 16 | 1 + 17 | 1 + 18 | 1 + 19 | 1 + 20 | 1 + 21 | 1 + 22 | 1 + 23 | 1 + 24 | 1 25 | 1 + 26 | 1 + 27 | 1 + 28 | 1 + 29 | 1 + 30 | 1 + 31 | 1 + 32 | 1 + 33 | 1 + 34 | 1 + 35 | 1 36 | 1 - 39 | 1 - 10 | 1 37 | 1 + 38 | 1 + 39 | 1 + 40 | 1 (40 rows) SELECT distinct foo.a, bar.b from orca.foo, orca.bar where foo.b = bar.a; a | b ----+--- - 5 | 1 - 27 | 1 + 15 | 1 7 | 1 35 | 1 - 21 | 1 - 19 | 1 - 15 | 1 - 17 | 1 - 13 | 1 - 1 | 1 - 29 | 1 - 25 | 1 39 | 1 + 25 | 1 + 29 | 1 + 11 | 1 + 5 | 1 + 33 | 1 + 19 | 1 37 | 1 23 | 1 - 3 | 1 - 33 | 1 - 11 | 1 - 31 | 1 + 1 | 1 9 | 1 + 27 | 1 + 13 | 1 + 17 | 1 + 21 | 1 + 31 | 1 + 3 | 1 (20 rows) SELECT distinct foo.a, bar.b, sum(bar.c+foo.c) from orca.foo, orca.bar where foo.b = bar.a group by foo.a, bar.b; a | b | sum ----+---+----- - 15 | 1 | 4 - 11 | 1 | 4 - 5 | 1 | 2 - 33 | 1 | 2 - 31 | 1 | 4 - 37 | 1 | 2 - 29 | 1 | 2 - 13 | 1 | 2 - 21 | 1 | 2 + 1 | 1 | 2 3 | 1 | 4 - 17 | 1 | 2 + 5 | 1 | 2 7 | 1 | 4 - 27 | 1 | 4 - 25 | 1 | 2 9 | 1 | 2 - 39 | 1 | 4 - 1 | 1 | 2 - 35 | 1 | 4 + 11 | 1 | 4 + 13 | 1 | 2 + 15 | 1 | 4 + 17 | 1 | 2 19 | 1 | 4 + 21 | 1 | 2 23 | 1 | 4 + 25 | 1 | 2 + 27 | 1 | 4 + 29 | 1 | 2 + 31 | 1 | 4 + 33 | 1 | 2 + 35 | 1 | 4 + 37 | 1 | 2 + 39 | 1 | 4 (20 rows) -- window operations @@ -6591,12 +6585,12 @@ select (select rank() over() from orca_w3 where a = orca_w1.a) as one, row_numbe | 1 | 2 | 3 - | 1 - | 2 - | 3 1 | 1 1 | 2 1 | 3 + | 1 + | 2 + | 3 (9 rows) -- window function in IN clause @@ -6625,9 +6619,9 @@ select (select rank() over(partition by orca_w2.a) from orca_w3 where a = orca_w select (select a+1 from (select a from orca_w2 where orca_w1.a=orca_w2.a) sq(a)) as one, row_number() over(partition by orca_w1.a) as two from orca_w1; one | two -----+----- + | 1 3 | 1 4 | 1 - | 1 (3 rows) -- correlated subquery in target list, mismatching varattnos @@ -6714,46 +6708,46 @@ select rank() over(partition by a, case when b = 0 then a+b end order by b asc) select foo.d from orca.foo full join orca.bar on (foo.d = bar.a) group by d; d ---- - 24 - 19 - 18 + 30 + 35 + 14 37 - 22 - 39 - 27 - 34 - 2 - 7 - 4 - 29 - 8 16 - 3 - 20 - 23 - 35 - 30 - 1 + 28 31 - 0 - 12 - 38 + 1 + 17 15 36 - 26 - 5 - 13 - 11 - 10 + 34 33 - 17 + 2 + 0 + 13 + 29 + 7 + 19 + 39 + 18 6 + 4 21 - 28 - 25 - 14 + 20 + 38 + 3 + 5 + 22 + 24 9 + 12 + 8 + 26 + 27 32 + 11 + 23 + 25 + 10 (40 rows) select 1 as v from orca.foo full join orca.bar on (foo.d = bar.a) group by d; @@ -6839,118 +6833,118 @@ insert into orca.rcte select i, i%2, i%3 from generate_series(1,40)i; with x as (select * from orca.rcte where a < 10) select * from x x1, x x2; a | b | c | a | b | c ---+---+---+---+---+--- - 2 | 0 | 2 | 5 | 1 | 2 - 2 | 0 | 2 | 6 | 0 | 0 + 8 | 0 | 2 | 8 | 0 | 2 + 8 | 0 | 2 | 9 | 1 | 0 + 8 | 0 | 2 | 3 | 1 | 0 + 8 | 0 | 2 | 4 | 0 | 1 + 8 | 0 | 2 | 5 | 1 | 2 + 8 | 0 | 2 | 6 | 0 | 0 + 8 | 0 | 2 | 7 | 1 | 1 + 8 | 0 | 2 | 1 | 1 | 1 + 8 | 0 | 2 | 2 | 0 | 2 + 9 | 1 | 0 | 8 | 0 | 2 + 9 | 1 | 0 | 9 | 1 | 0 + 9 | 1 | 0 | 3 | 1 | 0 + 9 | 1 | 0 | 4 | 0 | 1 + 9 | 1 | 0 | 5 | 1 | 2 + 9 | 1 | 0 | 6 | 0 | 0 + 9 | 1 | 0 | 7 | 1 | 1 + 9 | 1 | 0 | 1 | 1 | 1 + 9 | 1 | 0 | 2 | 0 | 2 + 1 | 1 | 1 | 8 | 0 | 2 + 1 | 1 | 1 | 9 | 1 | 0 + 1 | 1 | 1 | 1 | 1 | 1 + 1 | 1 | 1 | 2 | 0 | 2 + 1 | 1 | 1 | 3 | 1 | 0 + 1 | 1 | 1 | 4 | 0 | 1 + 1 | 1 | 1 | 5 | 1 | 2 + 1 | 1 | 1 | 6 | 0 | 0 + 1 | 1 | 1 | 7 | 1 | 1 + 2 | 0 | 2 | 8 | 0 | 2 2 | 0 | 2 | 9 | 1 | 0 + 2 | 0 | 2 | 1 | 1 | 1 2 | 0 | 2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 1 | 1 | 1 - 9 | 1 | 0 | 2 | 0 | 2 - 9 | 1 | 0 | 3 | 1 | 0 - 9 | 1 | 0 | 4 | 0 | 1 - 9 | 1 | 0 | 7 | 1 | 1 - 9 | 1 | 0 | 8 | 0 | 2 - 9 | 1 | 0 | 5 | 1 | 2 - 9 | 1 | 0 | 6 | 0 | 0 - 9 | 1 | 0 | 9 | 1 | 0 - 9 | 1 | 0 | 1 | 1 | 1 + 6 | 0 | 0 | 2 | 0 | 2 + 7 | 1 | 1 | 8 | 0 | 2 + 7 | 1 | 1 | 9 | 1 | 0 + 7 | 1 | 1 | 3 | 1 | 0 + 7 | 1 | 1 | 4 | 0 | 1 + 7 | 1 | 1 | 5 | 1 | 2 + 7 | 1 | 1 | 6 | 0 | 0 + 7 | 1 | 1 | 7 | 1 | 1 + 7 | 1 | 1 | 1 | 1 | 1 + 7 | 1 | 1 | 2 | 0 | 2 (81 rows) with x as (select * from orca.rcte where a < 10) select * from x x1, x x2 where x2.a = x1.b; a | b | c | a | b | c ---+---+---+---+---+--- - 3 | 1 | 0 | 1 | 1 | 1 - 7 | 1 | 1 | 1 | 1 | 1 1 | 1 | 1 | 1 | 1 | 1 + 3 | 1 | 0 | 1 | 1 | 1 5 | 1 | 2 | 1 | 1 | 1 + 7 | 1 | 1 | 1 | 1 | 1 9 | 1 | 0 | 1 | 1 | 1 (5 rows) with x as (select * from orca.rcte where a < 10) select a from x union all select b from x; a --- + 3 + 4 5 6 - 9 + 7 1 0 1 + 0 1 - 1 - 2 - 3 - 4 - 7 8 + 9 0 1 - 0 + 1 + 2 1 0 (18 rows) @@ -6959,10 +6953,10 @@ with x as (select * from orca.rcte where a < 10) select * from x x1 where x1.b = a | b | c ---+---+--- 1 | 1 | 1 - 5 | 1 | 2 - 9 | 1 | 0 3 | 1 | 0 + 5 | 1 | 2 7 | 1 | 1 + 9 | 1 | 0 (5 rows) with x as (select * from orca.rcte where a < 10) select * from x x1 where x1.b = all (select x2.a from x x2 group by x2.a); @@ -6973,39 +6967,39 @@ with x as (select * from orca.rcte where a < 10) select * from x x1 where x1.b = with x as (select * from orca.rcte where a < 10) select * from x x1, x x2, x x3 where x2.a = x1.b and x3.b = x2.b ; a | b | c | a | b | c | a | b | c ---+---+---+---+---+---+---+---+--- - 3 | 1 | 0 | 1 | 1 | 1 | 9 | 1 | 0 - 3 | 1 | 0 | 1 | 1 | 1 | 5 | 1 | 2 + 9 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 + 7 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 + 5 | 1 | 2 | 1 | 1 | 1 | 1 | 1 | 1 3 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 - 3 | 1 | 0 | 1 | 1 | 1 | 7 | 1 | 1 + 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 + 9 | 1 | 0 | 1 | 1 | 1 | 3 | 1 | 0 + 7 | 1 | 1 | 1 | 1 | 1 | 3 | 1 | 0 + 5 | 1 | 2 | 1 | 1 | 1 | 3 | 1 | 0 3 | 1 | 0 | 1 | 1 | 1 | 3 | 1 | 0 - 7 | 1 | 1 | 1 | 1 | 1 | 9 | 1 | 0 + 1 | 1 | 1 | 1 | 1 | 1 | 3 | 1 | 0 + 9 | 1 | 0 | 1 | 1 | 1 | 5 | 1 | 2 7 | 1 | 1 | 1 | 1 | 1 | 5 | 1 | 2 - 7 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 - 7 | 1 | 1 | 1 | 1 | 1 | 7 | 1 | 1 - 7 | 1 | 1 | 1 | 1 | 1 | 3 | 1 | 0 - 5 | 1 | 2 | 1 | 1 | 1 | 9 | 1 | 0 5 | 1 | 2 | 1 | 1 | 1 | 5 | 1 | 2 - 5 | 1 | 2 | 1 | 1 | 1 | 1 | 1 | 1 + 3 | 1 | 0 | 1 | 1 | 1 | 5 | 1 | 2 + 1 | 1 | 1 | 1 | 1 | 1 | 5 | 1 | 2 + 9 | 1 | 0 | 1 | 1 | 1 | 7 | 1 | 1 + 7 | 1 | 1 | 1 | 1 | 1 | 7 | 1 | 1 5 | 1 | 2 | 1 | 1 | 1 | 7 | 1 | 1 - 5 | 1 | 2 | 1 | 1 | 1 | 3 | 1 | 0 + 3 | 1 | 0 | 1 | 1 | 1 | 7 | 1 | 1 + 1 | 1 | 1 | 1 | 1 | 1 | 7 | 1 | 1 9 | 1 | 0 | 1 | 1 | 1 | 9 | 1 | 0 - 9 | 1 | 0 | 1 | 1 | 1 | 5 | 1 | 2 - 9 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 - 9 | 1 | 0 | 1 | 1 | 1 | 7 | 1 | 1 - 9 | 1 | 0 | 1 | 1 | 1 | 3 | 1 | 0 + 7 | 1 | 1 | 1 | 1 | 1 | 9 | 1 | 0 + 5 | 1 | 2 | 1 | 1 | 1 | 9 | 1 | 0 + 3 | 1 | 0 | 1 | 1 | 1 | 9 | 1 | 0 1 | 1 | 1 | 1 | 1 | 1 | 9 | 1 | 0 - 1 | 1 | 1 | 1 | 1 | 1 | 5 | 1 | 2 - 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 - 1 | 1 | 1 | 1 | 1 | 1 | 7 | 1 | 1 - 1 | 1 | 1 | 1 | 1 | 1 | 3 | 1 | 0 (25 rows) with x as (select * from orca.rcte where a < 10) select * from x x2 where x2.b < (select avg(b) from x x1); a | b | c ---+---+--- - 6 | 0 | 0 2 | 0 | 2 4 | 0 | 1 + 6 | 0 | 0 8 | 0 | 2 (4 rows) @@ -7242,695 +7236,695 @@ with x as (select r.a from orca.r, orca.s where r.a < 10 and s.d < 10 and r.a = with x as (select r.a from orca.r, orca.s where r.a < 10 and s.c < 10 and r.a = s.c) select * from x x1, x x2; a | a ---+--- - 1 | 5 - 1 | 6 - 1 | 5 - 1 | 6 - 1 | 5 - 1 | 6 - 1 | 5 - 1 | 6 - 1 | 1 - 1 | 1 - 1 | 1 - 1 | 1 - 1 | 1 - 1 | 2 - 1 | 3 - 1 | 4 - 1 | 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R: more than one row returned by a subquery used as an expression select (select generate_series(1,5)); ERROR: more than one row returned by a subquery used as an expression select (select a from orca.foo inner1 where inner1.a=outer1.a union select b from orca.foo inner2 where inner2.b=outer1.b) from orca.foo outer1; -ERROR: more than one row returned by a subquery used as an expression (seg2 slice3 127.0.1.1:6004 pid=663328) +ERROR: more than one row returned by a subquery used as an expression (seg0 slice3 192.168.0.37:25432 pid=14095) select (select generate_series(1,1)) as series; series -------- @@ -8106,10 +8100,10 @@ group by ten having exists (select 1 from orca.onek b where sum(distinct a.four) = b.four); ten | sum -----+----- - 3 | 3 - 4 | 2 0 | 2 1 | 3 + 3 | 3 + 4 | 2 9 | 3 (5 rows) @@ -8119,6 +8113,7 @@ NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. NOTICE: CREATE TABLE will create partition "pp_1_prt_pp1" for table "pp" create index pp_a on orca.pp(a); +NOTICE: building index for child partition "pp_1_prt_pp1" -- list partition tests -- test homogeneous partitions drop table if exists orca.t; @@ -8205,8 +8200,8 @@ insert into orca.multilevel_p values (1,1), (100,200); select * from orca.multilevel_p; a | b -----+----- - 100 | 200 1 | 1 + 100 | 200 (2 rows) -- test appendonly @@ -8377,26 +8372,23 @@ set optimizer_enable_space_pruning=off; set optimizer_enable_constant_expression_evaluation=on; set optimizer_enumerate_plans=on; set optimizer_plan_id = 2; --- start_ignore -analyze orca.t_date; --- end_ignore explain select * from orca.t_date where user_id=9; QUERY PLAN ------------------------------------------------------------------------------------ Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..8.19 rows=6 width=21) -> Append (cost=0.00..8.19 rows=2 width=21) -> Seq Scan on t_date_1_prt_part201203 (cost=0.00..3.12 rows=1 width=20) - Filter: (user_id = '9'::numeric) + Filter: user_id = 9::numeric -> Seq Scan on t_date_1_prt_part201204 (cost=0.00..1.01 rows=1 width=21) - Filter: (user_id = '9'::numeric) + Filter: user_id = 9::numeric -> Seq Scan on t_date_1_prt_part201205 (cost=0.00..1.01 rows=1 width=21) - Filter: (user_id = '9'::numeric) + Filter: user_id = 9::numeric -> Seq Scan on t_date_1_prt_part201206 (cost=0.00..1.01 rows=1 width=21) - Filter: (user_id = '9'::numeric) + Filter: user_id = 9::numeric -> Seq Scan on t_date_1_prt_part201207 (cost=0.00..1.01 rows=1 width=21) - Filter: (user_id = '9'::numeric) + Filter: user_id = 9::numeric -> Seq Scan on t_date_1_prt_part201208 (cost=0.00..1.01 rows=1 width=21) - Filter: (user_id = '9'::numeric) + Filter: user_id = 9::numeric Optimizer: Postgres query optimizer (15 rows) @@ -8438,20 +8430,17 @@ set optimizer_enable_space_pruning=off; set optimizer_enable_constant_expression_evaluation=on; set optimizer_enumerate_plans=on; set optimizer_plan_id = 2; --- start_ignore -analyze orca.t_text; --- end_ignore explain select * from orca.t_text where user_id=9; QUERY PLAN ---------------------------------------------------------------------------------- - Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..9.19 rows=3 width=21) - -> Append (cost=0.00..9.19 rows=1 width=21) + Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..7.19 rows=3 width=21) + -> Append (cost=0.00..7.19 rows=1 width=21) -> Seq Scan on t_text_1_prt_partgood (cost=0.00..3.06 rows=1 width=20) - Filter: (user_id = '9'::numeric) - -> Seq Scan on t_text_1_prt_partbad (cost=0.00..3.06 rows=1 width=21) - Filter: (user_id = '9'::numeric) - -> Seq Scan on t_text_1_prt_partugly (cost=0.00..3.06 rows=1 width=21) - Filter: (user_id = '9'::numeric) + Filter: user_id = 9::numeric + -> Seq Scan on t_text_1_prt_partbad (cost=0.00..2.06 rows=1 width=21) + Filter: user_id = 9::numeric + -> Seq Scan on t_text_1_prt_partugly (cost=0.00..2.06 rows=1 width=21) + Filter: user_id = 9::numeric Optimizer: Postgres query optimizer (9 rows) @@ -8502,18 +8491,15 @@ insert into orca.t_employee values('01-07-2012'::date,1,'tag1','(1, ''foo'')'::o insert into orca.t_employee values('01-08-2012'::date,2,'tag1','(2, ''foo'')'::orca.employee); set optimizer_enable_constant_expression_evaluation=on; set optimizer_enable_dynamictablescan = off; --- start_ignore -analyze orca.t_employee; --- end_ignore explain select * from orca.t_employee where user_id = 2; QUERY PLAN ----------------------------------------------------------------------------------- - Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..2.09 rows=4 width=47) - -> Append (cost=0.00..2.09 rows=2 width=47) - -> Seq Scan on t_employee_1_prt_part1 (cost=0.00..1.05 rows=1 width=46) - Filter: (user_id = '2'::numeric) + Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..3.09 rows=4 width=47) + -> Append (cost=0.00..3.09 rows=2 width=47) + -> Seq Scan on t_employee_1_prt_part1 (cost=0.00..2.05 rows=1 width=46) + Filter: user_id = 2::numeric -> Seq Scan on t_employee_1_prt_part2 (cost=0.00..1.04 rows=1 width=47) - Filter: (user_id = '2'::numeric) + Filter: user_id = 2::numeric Optimizer: Postgres query optimizer (7 rows) @@ -8550,20 +8536,17 @@ set optimizer_enable_constant_expression_evaluation=on; set optimizer_use_external_constant_expression_evaluation_for_ints = on; set optimizer_enumerate_plans=on; set optimizer_plan_id = 2; --- start_ignore -analyze orca.t_ceeval_ints; --- end_ignore explain select * from orca.t_ceeval_ints where user_id=4; QUERY PLAN ---------------------------------------------------------------------------------------- - Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..5.06 rows=3 width=21) - -> Append (cost=0.00..5.06 rows=1 width=21) - -> Seq Scan on t_ceeval_ints_1_prt_part100 (cost=0.00..3.04 rows=1 width=21) - Filter: (user_id = '4'::numeric) + Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..4.06 rows=3 width=21) + -> Append (cost=0.00..4.06 rows=1 width=21) + -> Seq Scan on t_ceeval_ints_1_prt_part100 (cost=0.00..2.04 rows=1 width=21) + Filter: user_id = 4::numeric -> Seq Scan on t_ceeval_ints_1_prt_part101 (cost=0.00..1.01 rows=1 width=21) - Filter: (user_id = '4'::numeric) + Filter: user_id = 4::numeric -> Seq Scan on t_ceeval_ints_1_prt_part103 (cost=0.00..1.01 rows=1 width=21) - Filter: (user_id = '4'::numeric) + Filter: user_id = 4::numeric Optimizer: Postgres query optimizer (9 rows) @@ -8628,9 +8611,9 @@ insert into orca.fooh2 select i%3, i%2, i from generate_series(1,20) i; select sum(f1.b) from orca.fooh1 f1 group by f1.a; sum ----- - 6 6 5 + 6 4 (4 rows) @@ -8644,8 +8627,8 @@ select 1 as one, f1.a from orca.fooh1 f1 group by f1.a having sum(f1.b) > 4; one | a -----+--- 1 | 1 - 1 | 0 1 | 2 + 1 | 0 (3 rows) select f1.a, 1 as one from orca.fooh1 f1 group by f1.a having 10 > (select f2.a from orca.fooh2 f2 group by f2.a having sum(f1.a) > count(*) order by f2.a limit 1) order by f1.a; @@ -8739,28 +8722,28 @@ select f1.a, 1 as one from orca.fooh1 f1 group by f1.a having f1.a = (select f2. select sum(f1.a+1)+1 from orca.fooh1 f1 group by f1.a+1; ?column? ---------- - 6 - 11 21 16 + 6 + 11 (4 rows) select sum(f1.a+1)+sum(f1.a+1) from orca.fooh1 f1 group by f1.a+1; ?column? ---------- - 20 40 30 10 + 20 (4 rows) select sum(f1.a+1)+avg(f1.a+1), sum(f1.a), sum(f1.a+1) from orca.fooh1 f1 group by f1.a+1; ?column? | sum | sum ------------------------+-----+----- - 12.0000000000000000 | 5 | 10 24.0000000000000000 | 15 | 20 18.0000000000000000 | 10 | 15 6.00000000000000000000 | 0 | 5 + 12.0000000000000000 | 5 | 10 (4 rows) -- @@ -8791,36 +8774,36 @@ select a, (select sum(e) from bar where foo.b = bar.f), b, count(*) from foo, ja select foo.a, (select (foo.a + foo.b) * count(bar.e) from bar), b, count(*) from foo group by foo.a, foo.b, foo.a + foo.b; a | ?column? | b | count ---+----------+---+------- - 3 | 18 | 3 | 1 2 | 12 | 2 | 1 1 | 6 | 1 | 1 + 3 | 18 | 3 | 1 (3 rows) -- aggfunc over an outer reference in a subquery select (select sum(foo.a + bar.d) from bar) from foo group by a, b; sum ----- + 9 15 12 - 9 (3 rows) -- complex expression of aggfunc over an outer reference in a subquery select (select sum(foo.a + bar.d) + 1 from bar) from foo group by a, b; ?column? ---------- - 16 13 10 + 16 (3 rows) -- aggrefs with multiple agglevelsup select (select (select sum(foo.a + bar.d) from jazz) from bar) from foo group by a, b; sum ----- + 9 15 12 - 9 (3 rows) -- aggrefs with multiple agglevelsup in an expression @@ -8845,9 +8828,9 @@ select (select max(f) from bar where d = 1 group by a, e) from foo group by a; select a, count(*), (with cte as (select min(d) dd from bar group by e) select max(a * dd) from cte) from foo group by a; a | count | max ---+-------+----- + 1 | 1 | 3 2 | 1 | 6 3 | 1 | 9 - 1 | 1 | 3 (3 rows) -- cte with an aggfunc of outer ref in an complex expression @@ -8863,9 +8846,9 @@ select a, count(*), (with cte as (select e, min(d) as dd from bar group by e) se select max(a) from foo group by (select e from bar where bar.e = foo.a); max ----- + 1 2 3 - 1 (3 rows) -- nested subquery in group by @@ -8949,9 +8932,9 @@ select foo.b+1, sum((with cte as (select * from jazz) select 1 from cte where ct select foo.b+1, sum((with cte as (select * from jazz) select 1 from cte cte1, cte cte2 where cte1.h = foo.b)) as t FROM foo GROUP BY foo.b; ?column? | t ----------+--- - 2 | 3 | 1 4 | + 2 | (3 rows) drop table foo, bar, jazz; @@ -8965,9 +8948,9 @@ insert into orca.t77 select 'orange'::text; SELECT to_char(AVG( char_length(DT466.C952) ), '9999999.9999999'), MAX( char_length(DT466.C952) ) FROM orca.t77 DT466 GROUP BY char_length(DT466.C952); to_char | max ------------------+----- - 5.0000000 | 5 6.0000000 | 6 4.0000000 | 4 + 5.0000000 | 5 (3 rows) create table orca.prod9 (sale integer, prodnm varchar,price integer); @@ -8980,8 +8963,8 @@ insert into orca.prod9 values (300, 't-shirts', 300); select prodnm, price from orca.prod9 GROUP BY prodnm, price HAVING price !=300; prodnm | price --------+------- - shirts | 500 pants | 800 + shirts | 500 (2 rows) -- analyze on tables with dropped attributes @@ -9014,9 +8997,9 @@ insert into orca.uu values (1,3); select * from (select a, a from orca.ur union select c, d from orca.us) x(g,h); g | h ---+--- - 2 | 2 1 | 1 1 | 3 + 2 | 2 (3 rows) select * from (select a, a from orca.ur union select c, d from orca.us) x(g,h), orca.ut t where t.a = x.h; @@ -9097,7 +9080,7 @@ create table orca.tab1 (i, j) as select i,i%2 from generate_series(1,10) i; NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'i' as the Greenplum Database data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. create table orca.tab2 (a, b) as select 1, 2; -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named '?column?' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'a' as the Greenplum Database data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. select * from orca.tab1 where 0 < (select count(*) from generate_series(1,i)) order by 1; i | j @@ -9117,14 +9100,14 @@ select * from orca.tab1 where 0 < (select count(*) from generate_series(1,i)) or select * from orca.tab1 where i > (select b from orca.tab2); i | j ----+--- - 5 | 1 - 6 | 0 - 9 | 1 - 10 | 0 3 | 1 4 | 0 + 5 | 1 + 6 | 0 7 | 1 8 | 0 + 9 | 1 + 10 | 0 (8 rows) -- subqueries @@ -9246,9 +9229,9 @@ select * from mpp22791 where b > 1; select * from mpp22791 where b <= 3; a | b ---+--- + 1 | 1 2 | 2 3 | 3 - 1 | 1 (3 rows) -- MPP-20713, MPP-20714, MPP-20738: Const table get with a filter @@ -9760,14 +9743,14 @@ select 1 as x where 1 in (2, 3); SELECT generate_series(1,10) EXCEPT SELECT 1; generate_series ----------------- - 6 + 2 + 3 4 5 + 6 + 7 8 - 2 9 - 3 - 7 10 (9 rows) @@ -9782,15 +9765,15 @@ SELECT generate_series(1,10) UNION SELECT 1; generate_series ----------------- 1 - 4 + 2 3 + 4 5 - 9 6 - 10 - 8 7 - 2 + 8 + 9 + 10 (10 rows) -- warning messages for missing stats @@ -9936,8 +9919,9 @@ where c.cid = s.cid and s.date_sk = d.date_sk and Hash Key: s.date_sk -> Seq Scan on sales s (cost=0.00..938.00 rows=28 width=40) Filter: ((lower(type) = 't1'::text) OR (upper(type) = 'T2'::text)) + Planning time: 2.896 ms Optimizer: Postgres query optimizer -(18 rows) +(19 rows) reset optimizer_segments; -- Bitmap indexes @@ -9950,13 +9934,14 @@ insert into orca.bm_test select i % 10, (i % 10)::text from generate_series(1, create index bm_test_idx on orca.bm_test using bitmap (i); set optimizer_enable_bitmapscan=on; explain select * from orca.bm_test where i=2 and t='2'; - QUERY PLAN + QUERY PLAN ---------------------------------------------------------------------------- Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..4.50 rows=4 width=6) -> Seq Scan on bm_test (cost=0.00..4.50 rows=2 width=6) - Filter: ((i = 2) AND (t = '2'::text)) - Optimizer: Postgres query optimizer -(4 rows) + Filter: i = 2 AND t = '2'::text + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(5 rows) select * from orca.bm_test where i=2 and t='2'; i | t @@ -9989,32 +9974,34 @@ NOTICE: CREATE TABLE will create partition "bm_dyn_test_1_prt_part3" for table NOTICE: CREATE TABLE will create partition "bm_dyn_test_1_prt_part4" for table "bm_dyn_test" insert into orca.bm_dyn_test select i % 10, 'drop', i % 5, (i % 10)::text from generate_series(1, 100) i; create index bm_dyn_test_idx on orca.bm_dyn_test using bitmap (i); +NOTICE: building index for child partition "bm_dyn_test_1_prt_part0" +NOTICE: building index for child partition "bm_dyn_test_1_prt_part1" +NOTICE: building index for child partition "bm_dyn_test_1_prt_part2" +NOTICE: building index for child partition "bm_dyn_test_1_prt_part3" +NOTICE: building index for child partition "bm_dyn_test_1_prt_part4" alter table orca.bm_dyn_test drop column to_be_dropped; alter table orca.bm_dyn_test add partition part5 values(5); NOTICE: CREATE TABLE will create partition "bm_dyn_test_1_prt_part5" for table "bm_dyn_test" insert into orca.bm_dyn_test values(2, 5, '2'); set optimizer_enable_dynamicbitmapscan=on; --- start_ignore -analyze orca.bm_dyn_test; --- end_ignore -- gather on 1 segment because of direct dispatch explain select * from orca.bm_dyn_test where i=2 and t='2'; QUERY PLAN ------------------------------------------------------------------------------------ - Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..9.52 rows=13 width=10) - -> Append (cost=0.00..9.52 rows=5 width=10) - -> Seq Scan on bm_dyn_test_1_prt_part0 (cost=0.00..1.30 rows=1 width=10) - Filter: ((i = 2) AND (t = '2'::text)) + Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..13.52 rows=13 width=10) + -> Append (cost=0.00..13.52 rows=5 width=10) + -> Seq Scan on bm_dyn_test_1_prt_part0 (cost=0.00..2.30 rows=1 width=10) + Filter: i = 2 AND t = '2'::text -> Seq Scan on bm_dyn_test_1_prt_part1 (cost=0.00..2.30 rows=1 width=10) - Filter: ((i = 2) AND (t = '2'::text)) - -> Seq Scan on bm_dyn_test_1_prt_part2 (cost=0.00..1.30 rows=3 width=10) - Filter: ((i = 2) AND (t = '2'::text)) - -> Seq Scan on bm_dyn_test_1_prt_part3 (cost=0.00..1.30 rows=1 width=10) - Filter: ((i = 2) AND (t = '2'::text)) + Filter: i = 2 AND t = '2'::text + -> Seq Scan on bm_dyn_test_1_prt_part2 (cost=0.00..3.30 rows=3 width=10) + Filter: i = 2 AND t = '2'::text + -> Seq Scan on bm_dyn_test_1_prt_part3 (cost=0.00..2.30 rows=1 width=10) + Filter: i = 2 AND t = '2'::text -> Seq Scan on bm_dyn_test_1_prt_part4 (cost=0.00..2.30 rows=1 width=10) - Filter: ((i = 2) AND (t = '2'::text)) + Filter: i = 2 AND t = '2'::text -> Seq Scan on bm_dyn_test_1_prt_part5 (cost=0.00..1.01 rows=1 width=10) - Filter: ((i = 2) AND (t = '2'::text)) + Filter: i = 2 AND t = '2'::text Optimizer: Postgres query optimizer (15 rows) @@ -10057,27 +10044,24 @@ NOTICE: CREATE TABLE will create partition "bm_dyn_test_onepart_1_prt_part5" fo insert into orca.bm_dyn_test_onepart values(2, 5, '2'); set optimizer_enable_bitmapscan=on; set optimizer_enable_dynamictablescan = off; --- start_ignore -analyze orca.bm_dyn_test_onepart; --- end_ignore -- gather on 1 segment because of direct dispatch explain select * from orca.bm_dyn_test_onepart where i=2 and t='2'; QUERY PLAN -------------------------------------------------------------------------------------------- - Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..9.52 rows=13 width=10) - -> Append (cost=0.00..9.52 rows=5 width=10) - -> Seq Scan on bm_dyn_test_onepart_1_prt_part0 (cost=0.00..1.30 rows=1 width=10) - Filter: ((i = 2) AND (t = '2'::text)) + Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..13.52 rows=13 width=10) + -> Append (cost=0.00..13.52 rows=5 width=10) + -> Seq Scan on bm_dyn_test_onepart_1_prt_part0 (cost=0.00..2.30 rows=1 width=10) + Filter: i = 2 AND t = '2'::text -> Seq Scan on bm_dyn_test_onepart_1_prt_part1 (cost=0.00..2.30 rows=1 width=10) - Filter: ((i = 2) AND (t = '2'::text)) - -> Seq Scan on bm_dyn_test_onepart_1_prt_part2 (cost=0.00..1.30 rows=3 width=10) - Filter: ((i = 2) AND (t = '2'::text)) - -> Seq Scan on bm_dyn_test_onepart_1_prt_part3 (cost=0.00..1.30 rows=1 width=10) - Filter: ((i = 2) AND (t = '2'::text)) + Filter: i = 2 AND t = '2'::text + -> Seq Scan on bm_dyn_test_onepart_1_prt_part2 (cost=0.00..3.30 rows=3 width=10) + Filter: i = 2 AND t = '2'::text + -> Seq Scan on bm_dyn_test_onepart_1_prt_part3 (cost=0.00..2.30 rows=1 width=10) + Filter: i = 2 AND t = '2'::text -> Seq Scan on bm_dyn_test_onepart_1_prt_part4 (cost=0.00..2.30 rows=1 width=10) - Filter: ((i = 2) AND (t = '2'::text)) + Filter: i = 2 AND t = '2'::text -> Seq Scan on bm_dyn_test_onepart_1_prt_part5 (cost=0.00..1.01 rows=1 width=10) - Filter: ((i = 2) AND (t = '2'::text)) + Filter: i = 2 AND t = '2'::text Optimizer: Postgres query optimizer (15 rows) @@ -10131,7 +10115,7 @@ analyze orca.bm_dyn_test_multilvl_part; explain select * from orca.bm_dyn_test_multilvl_part where year = 2019; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..6.62 rows=53 width=18) + Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..7.69 rows=53 width=18) -> Append (cost=0.00..6.62 rows=18 width=18) -> Seq Scan on bm_dyn_test_multilvl_part_1_prt_2_2_prt_1_3_prt_usa (cost=0.00..1.00 rows=1 width=44) Filter: (year = 2019) @@ -10168,6 +10152,11 @@ NOTICE: CREATE TABLE will create partition "het_bm_1_prt_part3" for table "het_ NOTICE: CREATE TABLE will create partition "het_bm_1_prt_part4" for table "het_bm" insert into bm.het_bm select i % 10, 'drop', i % 5, (i % 10)::text from generate_series(1, 100) i; create index het_bm_idx on bm.het_bm using bitmap (i); +NOTICE: building index for child partition "het_bm_1_prt_part0" +NOTICE: building index for child partition "het_bm_1_prt_part1" +NOTICE: building index for child partition "het_bm_1_prt_part2" +NOTICE: building index for child partition "het_bm_1_prt_part3" +NOTICE: building index for child partition "het_bm_1_prt_part4" alter table bm.het_bm drop column to_be_dropped; alter table bm.het_bm add partition part5 values(5); NOTICE: CREATE TABLE will create partition "het_bm_1_prt_part5" for table "het_bm" @@ -10194,6 +10183,11 @@ NOTICE: CREATE TABLE will create partition "hom_bm_heap_1_prt_part3" for table NOTICE: CREATE TABLE will create partition "hom_bm_heap_1_prt_part4" for table "hom_bm_heap" insert into bm.hom_bm_heap select i % 10, 'drop', i % 5, (i % 10)::text from generate_series(1, 100) i; create index hom_bm_heap_idx on bm.hom_bm_heap using bitmap (i); +NOTICE: building index for child partition "hom_bm_heap_1_prt_part0" +NOTICE: building index for child partition "hom_bm_heap_1_prt_part1" +NOTICE: building index for child partition "hom_bm_heap_1_prt_part2" +NOTICE: building index for child partition "hom_bm_heap_1_prt_part3" +NOTICE: building index for child partition "hom_bm_heap_1_prt_part4" alter table bm.hom_bm_heap drop column to_be_dropped; alter table bm.hom_bm_heap add partition part5 values(5); NOTICE: CREATE TABLE will create partition "hom_bm_heap_1_prt_part5" for table "hom_bm_heap" @@ -10222,6 +10216,11 @@ NOTICE: CREATE TABLE will create partition "hom_bm_ao_1_prt_part3" for table "h NOTICE: CREATE TABLE will create partition "hom_bm_ao_1_prt_part4" for table "hom_bm_ao" insert into bm.hom_bm_ao select i % 10, 'drop', i % 5, (i % 10)::text from generate_series(1, 100) i; create index hom_bm_ao_idx on bm.hom_bm_ao using bitmap (i); +NOTICE: building index for child partition "hom_bm_ao_1_prt_part0" +NOTICE: building index for child partition "hom_bm_ao_1_prt_part1" +NOTICE: building index for child partition "hom_bm_ao_1_prt_part2" +NOTICE: building index for child partition "hom_bm_ao_1_prt_part3" +NOTICE: building index for child partition "hom_bm_ao_1_prt_part4" alter table bm.hom_bm_ao drop column to_be_dropped; alter table bm.hom_bm_ao add partition part5 values(5); NOTICE: CREATE TABLE will create partition "hom_bm_ao_1_prt_part5" for table "hom_bm_ao" @@ -10250,6 +10249,11 @@ NOTICE: CREATE TABLE will create partition "hom_bm_aoco_1_prt_part3" for table NOTICE: CREATE TABLE will create partition "hom_bm_aoco_1_prt_part4" for table "hom_bm_aoco" insert into bm.hom_bm_aoco select i % 10, 'drop', i % 5, (i % 10)::text from generate_series(1, 100) i; create index hom_bm_aoco_idx on bm.hom_bm_aoco using bitmap (i); +NOTICE: building index for child partition "hom_bm_aoco_1_prt_part0" +NOTICE: building index for child partition "hom_bm_aoco_1_prt_part1" +NOTICE: building index for child partition "hom_bm_aoco_1_prt_part2" +NOTICE: building index for child partition "hom_bm_aoco_1_prt_part3" +NOTICE: building index for child partition "hom_bm_aoco_1_prt_part4" alter table bm.hom_bm_aoco drop column to_be_dropped; alter table bm.hom_bm_aoco add partition part5 values(5); NOTICE: CREATE TABLE will create partition "hom_bm_aoco_1_prt_part5" for table "hom_bm_aoco" @@ -10275,7 +10279,17 @@ NOTICE: CREATE TABLE will create partition "het_bm_1_prt_part4" for table "het_ insert into bm.het_bm select i % 10, 'drop', i % 5, (i % 10)::text from generate_series(1, 100) i; -- Create index before dropping a column create index het_bm_i_idx on bm.het_bm using bitmap (i); +NOTICE: building index for child partition "het_bm_1_prt_part0" +NOTICE: building index for child partition "het_bm_1_prt_part1" +NOTICE: building index for child partition "het_bm_1_prt_part2" +NOTICE: building index for child partition "het_bm_1_prt_part3" +NOTICE: building index for child partition "het_bm_1_prt_part4" create index het_bm_j_idx on bm.het_bm using bitmap (j); +NOTICE: building index for child partition "het_bm_1_prt_part0" +NOTICE: building index for child partition "het_bm_1_prt_part1" +NOTICE: building index for child partition "het_bm_1_prt_part2" +NOTICE: building index for child partition "het_bm_1_prt_part3" +NOTICE: building index for child partition "het_bm_1_prt_part4" alter table bm.het_bm drop column to_be_dropped; alter table bm.het_bm add partition part5 values(5); NOTICE: CREATE TABLE will create partition "het_bm_1_prt_part5" for table "het_bm" @@ -10296,7 +10310,19 @@ select sum(i) i_sum, sum(j) j_sum, sum(t::integer) t_sum from bm.het_bm where i= drop index bm.het_bm_i_idx; drop index bm.het_bm_j_idx; create index het_bm_i_idx on bm.het_bm using bitmap (i); +NOTICE: building index for child partition "het_bm_1_prt_part0" +NOTICE: building index for child partition "het_bm_1_prt_part1" +NOTICE: building index for child partition "het_bm_1_prt_part2" +NOTICE: building index for child partition "het_bm_1_prt_part3" +NOTICE: building index for child partition "het_bm_1_prt_part4" +NOTICE: building index for child partition "het_bm_1_prt_part5" create index het_bm_j_idx on bm.het_bm using bitmap (j); +NOTICE: building index for child partition "het_bm_1_prt_part0" +NOTICE: building index for child partition "het_bm_1_prt_part1" +NOTICE: building index for child partition "het_bm_1_prt_part2" +NOTICE: building index for child partition "het_bm_1_prt_part3" +NOTICE: building index for child partition "het_bm_1_prt_part4" +NOTICE: building index for child partition "het_bm_1_prt_part5" select sum(i) i_sum, sum(j) j_sum, sum(t::integer) t_sum from bm.het_bm where j=2 or j=3; i_sum | j_sum | t_sum -------+-------+------- @@ -10321,7 +10347,19 @@ alter table bm.het_bm add partition part5 values(5); NOTICE: CREATE TABLE will create partition "het_bm_1_prt_part5" for table "het_bm" -- Create index after dropping a column but before we insert into newly created part create index het_bm_i_idx on bm.het_bm using bitmap (i); +NOTICE: building index for child partition "het_bm_1_prt_part0" +NOTICE: building index for child partition "het_bm_1_prt_part1" +NOTICE: building index for child partition "het_bm_1_prt_part2" +NOTICE: building index for child partition "het_bm_1_prt_part3" +NOTICE: building index for child partition "het_bm_1_prt_part4" +NOTICE: building index for child partition "het_bm_1_prt_part5" create index het_bm_j_idx on bm.het_bm using bitmap (j); +NOTICE: building index for child partition "het_bm_1_prt_part0" +NOTICE: building index for child partition "het_bm_1_prt_part1" +NOTICE: building index for child partition "het_bm_1_prt_part2" +NOTICE: building index for child partition "het_bm_1_prt_part3" +NOTICE: building index for child partition "het_bm_1_prt_part4" +NOTICE: building index for child partition "het_bm_1_prt_part5" insert into bm.het_bm values(2, 5, '2'); select sum(i) i_sum, sum(j) j_sum, sum(t::integer) t_sum from bm.het_bm where j=2 or j=3; i_sum | j_sum | t_sum @@ -10398,29 +10436,28 @@ END; $$ LANGUAGE plpgsql volatile; -- start_ignore select disable_xform('CXformInnerJoin2DynamicIndexGetApply'); - disable_xform ---------------------------------------- - Server has been compiled without ORCA + disable_xform +-------------------------------------------------- + CXformInnerJoin2DynamicIndexGetApply is disabled (1 row) select disable_xform('CXformInnerJoin2HashJoin'); - disable_xform ---------------------------------------- - Server has been compiled without ORCA + disable_xform +-------------------------------------- + CXformInnerJoin2HashJoin is disabled (1 row) select disable_xform('CXformInnerJoin2IndexGetApply'); - disable_xform ---------------------------------------- - Server has been compiled without ORCA + disable_xform +------------------------------------------- + CXformInnerJoin2IndexGetApply is disabled (1 row) select disable_xform('CXformInnerJoin2NLJoin'); - disable_xform ---------------------------------------- - Server has been compiled without ORCA + disable_xform +------------------------------------ + CXformInnerJoin2NLJoin is disabled (1 row) - -- end_ignore set optimizer_enable_partial_index=on; set optimizer_enable_indexjoin=on; @@ -10435,21 +10472,21 @@ WHERE tq.sym = tt.symbol AND tt.event_ts < tq.end_ts GROUP BY 1 ORDER BY 1 asc ; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) (cost=352568.33..352570.83 rows=1000 width=16) - Merge Key: ((((tt.event_ts / 100000) / 5) * 5)) - -> Sort (cost=352568.33..352570.83 rows=334 width=16) - Sort Key: ((((tt.event_ts / 100000) / 5) * 5)) - -> HashAggregate (cost=352508.50..352518.50 rows=334 width=16) - Group Key: ((((tt.event_ts / 100000) / 5) * 5)) - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=352466.00..352493.50 rows=334 width=16) - Hash Key: ((((tt.event_ts / 100000) / 5) * 5)) - -> HashAggregate (cost=352466.00..352473.50 rows=334 width=16) - Group Key: (((tt.event_ts / 100000) / 5) * 5) - -> Hash Join (cost=604.00..352296.76 rows=11283 width=8) - Hash Cond: ((tq.sym)::bpchar = tt.symbol) - Join Filter: ((tt.event_ts >= tq.ets) AND (tt.event_ts < tq.end_ts) AND (plusone(tq.bid_price) < tt.trade_price)) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------- + Gather Motion 3:1 (slice3; segments: 3) (cost=240615.63..240618.13 rows=1000 width=16) + Merge Key: (tt.event_ts / 100000 / 5 * 5) + -> Sort (cost=240615.63..240618.13 rows=334 width=16) + Sort Key: (tt.event_ts / 100000 / 5 * 5) + -> HashAggregate (cost=240553.30..240565.80 rows=334 width=16) + Group By: (tt.event_ts / 100000 / 5 * 5) + -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=240510.80..240538.30 rows=334 width=16) + Hash Key: (tt.event_ts / 100000 / 5 * 5) + -> HashAggregate (cost=240510.80..240518.30 rows=334 width=16) + Group By: tt.event_ts / 100000 / 5 * 5 + -> Hash Join (cost=604.00..240341.56 rows=11283 width=8) + Hash Cond: tq.sym::bpchar = tt.symbol + Join Filter: tt.event_ts >= tq.ets AND tt.event_ts < tq.end_ts AND plusone(tq.bid_price) < tt.trade_price -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..1424.00 rows=13600 width=98) Hash Key: tq.sym -> Append (cost=0.00..608.00 rows=13600 width=98) @@ -10457,8 +10494,9 @@ ORDER BY 1 asc ; -> Seq Scan on my_tq_agg_opt_part_1_prt_p2 tq_1 (cost=0.00..304.00 rows=6800 width=98) -> Hash (cost=324.00..324.00 rows=7467 width=108) -> Seq Scan on my_tt_agg_opt tt (cost=0.00..324.00 rows=7467 width=108) - Optimizer: Postgres query optimizer -(21 rows) + Settings: optimizer=off; optimizer_cte_inlining_bound=1000; optimizer_segments=3 + Optimizer status: Postgres query optimizer +(22 rows) reset optimizer_segments; reset optimizer_enable_constant_expression_evaluation; @@ -10466,27 +10504,27 @@ reset optimizer_enable_indexjoin; reset optimizer_enable_partial_index; -- start_ignore select enable_xform('CXformInnerJoin2DynamicIndexGetApply'); - enable_xform ---------------------------------------- - Server has been compiled without ORCA + enable_xform +------------------------------------------------- + CXformInnerJoin2DynamicIndexGetApply is enabled (1 row) select enable_xform('CXformInnerJoin2HashJoin'); - enable_xform ---------------------------------------- - Server has been compiled without ORCA + enable_xform +------------------------------------- + CXformInnerJoin2HashJoin is enabled (1 row) select enable_xform('CXformInnerJoin2IndexGetApply'); - enable_xform ---------------------------------------- - Server has been compiled without ORCA + enable_xform +------------------------------------------ + CXformInnerJoin2IndexGetApply is enabled (1 row) select enable_xform('CXformInnerJoin2NLJoin'); - enable_xform ---------------------------------------- - Server has been compiled without ORCA + enable_xform +----------------------------------- + CXformInnerJoin2NLJoin is enabled (1 row) -- end_ignore @@ -10528,26 +10566,27 @@ analyze idxscan_inner; set optimizer_enable_hashjoin = off; explain select id, comment from idxscan_outer as o join idxscan_inner as i on o.id = i.productid where ordernum between 10 and 20; - QUERY PLAN + QUERY PLAN ---------------------------------------------------------------------------------------------------- Gather Motion 3:1 (slice2; segments: 3) (cost=2.12..5.28 rows=4 width=9) -> Hash Join (cost=2.12..5.28 rows=2 width=9) - Hash Cond: (o.id = i.productid) + Hash Cond: o.id = i.productid -> Seq Scan on idxscan_outer o (cost=0.00..3.09 rows=3 width=4) -> Hash (cost=2.09..2.09 rows=1 width=9) -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..2.09 rows=1 width=9) Hash Key: i.productid -> Seq Scan on idxscan_inner i (cost=0.00..2.04 rows=1 width=9) - Filter: ((ordernum >= 10) AND (ordernum <= 20)) - Optimizer: Postgres query optimizer -(10 rows) + Filter: ordernum >= 10 AND ordernum <= 20 + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(11 rows) select id, comment from idxscan_outer as o join idxscan_inner as i on o.id = i.productid where ordernum between 10 and 20; id | comment ----+--------- - 3 | zzzz 1 | xxxx + 3 | zzzz (2 rows) reset optimizer_enable_hashjoin; @@ -10585,33 +10624,36 @@ create table orca.index_test (a int, b int, c int, d int, e int, constraint inde insert into orca.index_test select i,i%2,i%3,i%4,i%5 from generate_series(1,100) i; -- force_explain explain select * from orca.index_test where a = 5; - QUERY PLAN ------------------------------------------------------------------------------ + QUERY PLAN +-------------------------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.25 rows=1 width=20) -> Seq Scan on index_test (cost=0.00..4.25 rows=1 width=20) - Filter: (a = 5) - Optimizer: Postgres query optimizer -(4 rows) + Filter: a = 5 + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(5 rows) -- force_explain explain select * from orca.index_test where c = 5; - QUERY PLAN ------------------------------------------------------------------------------ + QUERY PLAN +-------------------------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.25 rows=1 width=20) -> Seq Scan on index_test (cost=0.00..4.25 rows=1 width=20) - Filter: (c = 5) - Optimizer: Postgres query optimizer -(4 rows) + Filter: c = 5 + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(5 rows) -- force_explain explain select * from orca.index_test where a = 5 and c = 5; - QUERY PLAN ------------------------------------------------------------------------------ + QUERY PLAN +-------------------------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.50 rows=1 width=20) -> Seq Scan on index_test (cost=0.00..4.50 rows=1 width=20) - Filter: ((a = 5) AND (c = 5)) - Optimizer: Postgres query optimizer -(4 rows) + Filter: a = 5 AND c = 5 + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(5 rows) -- renaming columns select * from (values (2),(null)) v(k); @@ -10673,7 +10715,6 @@ drop table can_set_tag_target; drop table can_set_tag_audit; -- start_ignore create language plpythonu; -ERROR: language "plpythonu" already exists -- end_ignore -- Checking if ORCA uses parser's canSetTag for CREATE TABLE AS SELECT create or replace function canSetTag_Func(x int) returns int as $$ @@ -10699,9 +10740,9 @@ CREATE INDEX btree_test_index ON btree_test(a); set optimizer_enable_tablescan = off; -- start_ignore select disable_xform('CXformSelect2IndexGet'); - disable_xform ---------------------------------------- - Server has been compiled without ORCA + disable_xform +----------------------------------- + CXformSelect2IndexGet is disabled (1 row) -- end_ignore @@ -10744,9 +10785,9 @@ EXPLAIN SELECT * FROM btree_test WHERE a in ('1', '2', 47); SELECT * FROM btree_test WHERE a in ('1', '2', 47); a | b ----+---- - 2 | 2 1 | 1 47 | 47 + 2 | 2 (3 rows) CREATE INDEX btree_test_index_ab ON btree_test using btree(a,b); @@ -10762,15 +10803,15 @@ EXPLAIN SELECT * FROM btree_test WHERE a in (1, 2, 47) AND b > 1; SELECT * FROM btree_test WHERE a in (1, 2, 47) AND b > 1; a | b ----+---- - 47 | 47 2 | 2 + 47 | 47 (2 rows) -- start_ignore select enable_xform('CXformSelect2IndexGet'); - enable_xform ---------------------------------------- - Server has been compiled without ORCA + enable_xform +---------------------------------- + CXformSelect2IndexGet is enabled (1 row) -- end_ignore @@ -10779,53 +10820,59 @@ reset optimizer_enable_tablescan; CREATE TABLE bitmap_test as SELECT * FROM generate_series(1,100) as a distributed randomly; CREATE INDEX bitmap_index ON bitmap_test USING BITMAP(a); EXPLAIN SELECT * FROM bitmap_test WHERE a in (1); - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.25 rows=1 width=4) - -> Seq Scan on bitmap_test (cost=0.00..4.25 rows=1 width=4) - Filter: (a = 1) - Optimizer: Postgres query optimizer -(4 rows) + -> Seq Scan on bitmap_test (cost=0.00..4.25 rows=1 width=4) + Filter: a = 1 + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(5 rows) EXPLAIN SELECT * FROM bitmap_test WHERE a in (1, 47); - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.25 rows=2 width=4) -> Seq Scan on bitmap_test (cost=0.00..4.25 rows=1 width=4) - Filter: (a = ANY ('{1,47}'::integer[])) - Optimizer: Postgres query optimizer -(4 rows) + Filter: a = ANY ('{1,47}'::integer[]) + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(5 rows) EXPLAIN SELECT * FROM bitmap_test WHERE a in ('2', 47); - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.25 rows=2 width=4) -> Seq Scan on bitmap_test (cost=0.00..4.25 rows=1 width=4) - Filter: (a = ANY ('{2,47}'::integer[])) - Optimizer: Postgres query optimizer -(4 rows) + Filter: a = ANY ('{2,47}'::integer[]) + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(5 rows) EXPLAIN SELECT * FROM bitmap_test WHERE a in ('1', '2'); - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.25 rows=2 width=4) -> Seq Scan on bitmap_test (cost=0.00..4.25 rows=1 width=4) - Filter: (a = ANY ('{1,2}'::integer[])) - Optimizer: Postgres query optimizer -(4 rows) + Filter: a = ANY ('{1,2}'::integer[]) + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(5 rows) EXPLAIN SELECT * FROM bitmap_test WHERE a in ('1', '2', 47); - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.38 rows=3 width=4) -> Seq Scan on bitmap_test (cost=0.00..4.38 rows=1 width=4) - Filter: (a = ANY ('{1,2,47}'::integer[])) - Optimizer: Postgres query optimizer -(4 rows) + Filter: a = ANY ('{1,2,47}'::integer[]) + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(5 rows) -- Test Logging for unsupported features in ORCA -- start_ignore drop table if exists foo; +NOTICE: table "foo" does not exist, skipping -- end_ignore create table foo(a int, b int) distributed by (a); -- The amount of log messages you get depends on a lot of options, but any @@ -10835,37 +10882,37 @@ set log_statement='none'; set log_min_duration_statement=-1; set client_min_messages='log'; explain select count(*) from foo group by cube(a,b); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------ Gather Motion 3:1 (slice3; segments: 3) (cost=10128.79..20306.02 rows=40897 width=28) -> Append (cost=10128.79..20306.02 rows=13633 width=28) -> HashAggregate (cost=10128.79..10408.61 rows=9328 width=28) - Group Key: "rollup".prelim_aggref_2, "rollup".prelim_aggref_1, "rollup"."grouping", "rollup"."group_id" + Group Key: "rollup".unnamed_attr_2, "rollup".unnamed_attr_1, "rollup"."grouping", "rollup"."group_id" -> Subquery Scan on "rollup" (cost=8552.10..10074.98 rows=1435 width=28) -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=8552.10..10031.93 rows=1435 width=28) - Hash Key: rollup_1.prelim_aggref_2, rollup_1.prelim_aggref_1, (Grouping), group_id() + Hash Key: rollup_1.unnamed_attr_2, rollup_1.unnamed_attr_1, (Grouping), group_id() -> GroupAggregate (cost=8552.10..9945.83 rows=1435 width=28) - Group Key: rollup_1."grouping", rollup_1."group_id", rollup_1.prelim_aggref_2, rollup_1.prelim_aggref_1 + Group Key: rollup_1."grouping", rollup_1."group_id" -> Subquery Scan on rollup_1 (cost=8552.10..9822.06 rows=2153 width=28) -> GroupAggregate (cost=8552.10..9757.49 rows=2153 width=28) - Group Key: rollup_2.prelim_aggref_2, rollup_2."grouping", rollup_2."group_id", rollup_2.prelim_aggref_1 + Group Key: rollup_2.unnamed_attr_2, rollup_2."grouping", rollup_2."group_id" -> Subquery Scan on rollup_2 (cost=8552.10..9585.30 rows=2870 width=28) -> GroupAggregate (cost=8552.10..9499.20 rows=2870 width=28) - Group Key: share0_ref1.b, share0_ref1.a + Group Key: b, a -> Sort (cost=8552.10..8767.35 rows=28700 width=8) - Sort Key: share0_ref1.b, share0_ref1.a + Sort Key: b, a -> Shared Scan (share slice:id 1:0) (cost=1391.50..1494.60 rows=28700 width=8) -> Materialize (cost=0.00..1391.50 rows=28700 width=8) -> Seq Scan on foo (cost=0.00..961.00 rows=28700 width=8) -> HashAggregate (cost=9639.11..9768.26 rows=4305 width=28) - Group Key: rollup_3.prelim_aggref_1, rollup_3.prelim_aggref_2, rollup_3."grouping", rollup_3."group_id" + Group Key: rollup_3.unnamed_attr_1, rollup_3.unnamed_attr_2, rollup_3."grouping", rollup_3."group_id" -> Subquery Scan on rollup_3 (cost=8552.10..9585.30 rows=1435 width=28) -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=8552.10..9542.25 rows=1435 width=28) - Hash Key: share0_ref2.a, share0_ref2.b, (Grouping), group_id() + Hash Key: a, b, (Grouping), group_id() -> GroupAggregate (cost=8552.10..9456.15 rows=1435 width=28) - Group Key: share0_ref2.a, share0_ref2.b + Group Key: a -> Sort (cost=8552.10..8767.35 rows=28700 width=8) - Sort Key: share0_ref2.a, share0_ref2.b + Sort Key: a, b -> Shared Scan (share slice:id 2:0) (cost=1391.50..1494.60 rows=28700 width=8) Optimizer: Postgres query optimizer (31 rows) @@ -10975,13 +11022,14 @@ HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sur -- end_ignore -- Query should not fallback to planner explain select * from foo where b in ('1', '2'); - QUERY PLAN --------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..667.50 rows=91 width=42) -> Seq Scan on foo (cost=0.00..667.50 rows=31 width=42) - Filter: ((b)::text = ANY ('{1,2}'::text[])) - Optimizer: Postgres query optimizer -(4 rows) + Filter: b::text = ANY ('{1,2}'::text[]) + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(5 rows) set optimizer_enable_ctas = off; set log_statement='none'; @@ -11067,7 +11115,7 @@ FROM (SELECT * -> Subquery Scan on a (cost=1.04..3.24 rows=2 width=0) -> Append (cost=1.04..3.20 rows=2 width=4) -> Hash Left Join (cost=1.04..2.14 rows=2 width=3) - Hash Cond: ((tab_1.id)::text = (tab_2.id)::text) + Hash Cond: tab_1.id::text = tab_2.id::text -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..1.06 rows=1 width=5) Hash Key: tab_1.id -> Seq Scan on tab_1 (cost=0.00..1.02 rows=1 width=5) @@ -11115,32 +11163,32 @@ set optimizer_enable_streaming_material = on; select c1 from t_outer where not c1 =all (select c2 from t_inner); c1 ---- - 7 + 8 + 9 10 - 3 - 6 - 2 1 - 5 - 8 + 2 + 3 4 - 9 + 5 + 6 + 7 (10 rows) set optimizer_enable_streaming_material = off; select c1 from t_outer where not c1 =all (select c2 from t_inner); c1 ---- - 3 - 6 - 7 + 8 + 9 10 - 2 1 - 5 - 8 + 2 + 3 4 - 9 + 5 + 6 + 7 (10 rows) reset optimizer_enable_streaming_material; @@ -11240,10 +11288,10 @@ insert into y_tab select 1 union all select a from x_tab limit 10; select * from y_tab; a --- - 0 1 1 1 + 0 (4 rows) -- @@ -11311,17 +11359,18 @@ INSERT INTO csq_cast_param_inner VALUES (11, '11'), (101, '12'); EXPLAIN SELECT a FROM csq_cast_param_outer WHERE b in (SELECT CASE WHEN a > 1 THEN d ELSE '42' END FROM csq_cast_param_inner); - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice2; segments: 3) (cost=10000000000.00..10000000004.40 rows=4 width=4) - -> Nested Loop Semi Join (cost=10000000000.00..10000000004.40 rows=2 width=4) - Join Filter: ((CASE WHEN (csq_cast_param_outer.a > 1) THEN csq_cast_param_inner.d ELSE '42'::myint END)::bigint = (csq_cast_param_outer.b)::bigint) - -> Seq Scan on csq_cast_param_outer (cost=0.00..2.02 rows=1 width=8) - -> Materialize (cost=0.00..2.13 rows=2 width=4) - -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..2.10 rows=2 width=4) - -> Seq Scan on csq_cast_param_inner (cost=0.00..2.02 rows=1 width=4) - Optimizer: Postgres query optimizer -(8 rows) + QUERY PLAN +----------------------------------------------------------------------------------------------------------------- + Gather Motion 3:1 (slice2; segments: 3) (cost=1.11..2.49 rows=4 width=4) + -> Nested Loop Semi Join (cost=1.11..2.49 rows=2 width=4) + Join Filter: CASE WHEN csq_cast_param_outer.a > 1 THEN csq_cast_param_inner.d ELSE '42'::myint END::bigint = csq_cast_param_outer.b::bigint + -> Seq Scan on csq_cast_param_outer (cost=0.00..1.02 rows=1 width=8) + -> Materialize (cost=1.11..1.17 rows=2 width=4) + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..1.10 rows=2 width=4) + -> Seq Scan on csq_cast_param_inner (cost=0.00..1.02 rows=1 width=4) + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(9 rows) SELECT a FROM csq_cast_param_outer WHERE b in (SELECT CASE WHEN a > 1 THEN d ELSE '42' END FROM csq_cast_param_inner); a @@ -11334,23 +11383,24 @@ DROP CAST (myint as int8); CREATE FUNCTION myint_numeric(myint) RETURNS numeric AS 'int4_numeric' LANGUAGE INTERNAL STRICT IMMUTABLE; CREATE CAST (myint AS numeric) WITH FUNCTION myint_numeric(myint) AS IMPLICIT; EXPLAIN SELECT a FROM csq_cast_param_outer WHERE b in (SELECT CASE WHEN a > 1 THEN d ELSE '42' END FROM csq_cast_param_inner); - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice2; segments: 3) (cost=10000000000.00..10000000004.40 rows=4 width=4) - -> Nested Loop Semi Join (cost=10000000000.00..10000000004.40 rows=2 width=4) - Join Filter: ((CASE WHEN (csq_cast_param_outer.a > 1) THEN csq_cast_param_inner.d ELSE '42'::myint END)::numeric = (csq_cast_param_outer.b)::numeric) - -> Seq Scan on csq_cast_param_outer (cost=0.00..2.02 rows=1 width=8) - -> Materialize (cost=0.00..2.13 rows=2 width=4) - -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..2.10 rows=2 width=4) - -> Seq Scan on csq_cast_param_inner (cost=0.00..2.02 rows=1 width=4) - Optimizer: Postgres query optimizer -(8 rows) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------- + Gather Motion 3:1 (slice2; segments: 3) (cost=1.11..2.49 rows=4 width=4) + -> Nested Loop Semi Join (cost=1.11..2.49 rows=2 width=4) + Join Filter: CASE WHEN csq_cast_param_outer.a > 1 THEN csq_cast_param_inner.d ELSE '42'::myint END::numeric = csq_cast_param_outer.b::numeric + -> Seq Scan on csq_cast_param_outer (cost=0.00..1.02 rows=1 width=8) + -> Materialize (cost=1.11..1.17 rows=2 width=4) + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..1.10 rows=2 width=4) + -> Seq Scan on csq_cast_param_inner (cost=0.00..1.02 rows=1 width=4) + Settings: optimizer=off + Optimizer status: Postgres query optimizer +(9 rows) SELECT a FROM csq_cast_param_outer WHERE b in (SELECT CASE WHEN a > 1 THEN d ELSE '42' END FROM csq_cast_param_inner); a --- - 2 1 + 2 (2 rows) SELECT a FROM ggg WHERE a IN (NULL, 'x'); @@ -11366,7 +11416,7 @@ EXPLAIN SELECT a FROM ggg WHERE a NOT IN (NULL, ''); ---------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..1.01 rows=1 width=2) -> Seq Scan on ggg (cost=0.00..1.01 rows=1 width=2) - Filter: (a <> ALL ('{NULL,""}'::bpchar[])) + Filter: a <> ALL ('{NULL,""}'::bpchar[]) Optimizer: Postgres query optimizer (4 rows) @@ -11376,8 +11426,9 @@ EXPLAIN SELECT a FROM ggg WHERE a IN (NULL, 'x'); Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..1.01 rows=1 width=2) -> Seq Scan on ggg (cost=0.00..1.01 rows=1 width=2) Filter: (a = ANY ('{NULL,x}'::bpchar[])) + Planning time: 0.038 ms Optimizer: Postgres query optimizer -(4 rows) +(5 rows) -- result node with one time filter and filter CREATE TABLE onetimefilter1 (a int, b int); @@ -11455,11 +11506,11 @@ WITH abc AS (SELECT onetimefilter1.a, onetimefilter1.b FROM onetimefilter1, onet ?column? | coalesce | b ----------+----------+---- 1 | 0 | 1 - 1 | 0 | 2 1 | 0 | 3 1 | 0 | 4 1 | 0 | 7 1 | 0 | 8 + 1 | 0 | 2 1 | 0 | 5 1 | 0 | 6 1 | 0 | 9 @@ -11514,12 +11565,12 @@ SELECT * FROM touter LEFT JOIN tinnerbitmap ON touter.a = tinnerbitmap.a; SELECT * FROM touter LEFT JOIN tinnerbitmap ON touter.a = tinnerbitmap.a AND tinnerbitmap.b=10; a | b | a | b ----+---+---+--- - 1 | 1 | | 2 | 2 | | 3 | 3 | | 4 | 4 | | 7 | 1 | | 8 | 2 | | + 1 | 1 | | 5 | 5 | | 6 | 0 | | 9 | 3 | | @@ -11545,15 +11596,15 @@ SELECT * FROM touter LEFT JOIN tinnerbtree ON touter.a = tinnerbtree.a AND tinne a | b | a | b ----+---+---+--- 1 | 1 | | + 5 | 5 | | + 6 | 0 | | + 9 | 3 | | + 10 | 4 | | 2 | 2 | | 3 | 3 | | 4 | 4 | | 7 | 1 | | 8 | 2 | | - 5 | 5 | | - 6 | 0 | | - 9 | 3 | | - 10 | 4 | | (10 rows) -- test subplan in a qual under dynamic scan @@ -11585,55 +11636,48 @@ SELECT * FROM ds_part, non_part2 WHERE ds_part.c = non_part2.e AND non_part2.f = (0 rows) explain analyze SELECT * FROM ds_part, non_part2 WHERE ds_part.c = non_part2.e AND non_part2.f = 10 AND a IN ( SELECT b + 1 FROM non_part1); - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) (cost=10000000004.33..10000000039.13 rows=7 width=20) (actual time=2.817..2.817 rows=0 loops=1) - -> Nested Loop Semi Join (cost=10000000004.33..10000000039.13 rows=3 width=20) (never executed) - -> Hash Join (cost=4.33..28.40 rows=2 width=20) (never executed) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------- + Gather Motion 3:1 (slice3; segments: 3) (cost=10000000004.33..10000000039.13 rows=7 width=20) + -> Nested Loop Semi Join (cost=10000000004.33..10000000039.13 rows=3 width=20) + -> Hash Join (cost=4.33..28.40 rows=2 width=20) Hash Cond: (ds_part_1_prt_deflt.c = non_part2.e) - -> Append (cost=0.00..24.00 rows=2 width=12) (never executed) - -> Result (cost=0.00..17.87 rows=1 width=12) (never executed) + -> Append (cost=0.00..24.00 rows=2 width=12) + -> Result (cost=0.00..17.87 rows=1 width=12) One-Time Filter: PartSelected - -> Seq Scan on ds_part_1_prt_deflt (cost=0.00..17.87 rows=1 width=12) (never executed) + -> Seq Scan on ds_part_1_prt_deflt (cost=0.00..17.87 rows=1 width=12) Filter: (a = (b + 1)) - -> Result (cost=0.00..2.03 rows=1 width=12) (never executed) + -> Result (cost=0.00..2.03 rows=1 width=12) One-Time Filter: PartSelected - -> Seq Scan on ds_part_1_prt_2 (cost=0.00..2.03 rows=1 width=12) (never executed) + -> Seq Scan on ds_part_1_prt_2 (cost=0.00..2.03 rows=1 width=12) Filter: (a = (b + 1)) - -> Result (cost=0.00..1.03 rows=1 width=12) (never executed) + -> Result (cost=0.00..1.03 rows=1 width=12) One-Time Filter: PartSelected - -> Seq Scan on ds_part_1_prt_3 (cost=0.00..1.03 rows=1 width=12) (never executed) + -> Seq Scan on ds_part_1_prt_3 (cost=0.00..1.03 rows=1 width=12) Filter: (a = (b + 1)) - -> Result (cost=0.00..1.03 rows=1 width=12) (never executed) + -> Result (cost=0.00..1.03 rows=1 width=12) One-Time Filter: PartSelected - -> Seq Scan on ds_part_1_prt_4 (cost=0.00..1.03 rows=1 width=12) (never executed) + -> Seq Scan on ds_part_1_prt_4 (cost=0.00..1.03 rows=1 width=12) Filter: (a = (b + 1)) - -> Result (cost=0.00..1.03 rows=1 width=12) (never executed) + -> Result (cost=0.00..1.03 rows=1 width=12) One-Time Filter: PartSelected - -> Seq Scan on ds_part_1_prt_5 (cost=0.00..1.03 rows=1 width=12) (never executed) + -> Seq Scan on ds_part_1_prt_5 (cost=0.00..1.03 rows=1 width=12) Filter: (a = (b + 1)) - -> Result (cost=0.00..1.01 rows=1 width=12) (never executed) + -> Result (cost=0.00..1.01 rows=1 width=12) One-Time Filter: PartSelected - -> Seq Scan on ds_part_1_prt_6 (cost=0.00..1.01 rows=1 width=12) (never executed) + -> Seq Scan on ds_part_1_prt_6 (cost=0.00..1.01 rows=1 width=12) Filter: (a = (b + 1)) - -> Hash (cost=4.29..4.29 rows=1 width=8) (actual time=0.021..0.021 rows=1 loops=1) - -> Partition Selector for ds_part (dynamic scan id: 1) (cost=0.00..4.29 rows=1 width=8) (actual time=0.019..0.019 rows=1 loops=1) + -> Hash (cost=4.29..4.29 rows=1 width=8) + -> Partition Selector for ds_part (dynamic scan id: 1) (cost=0.00..4.29 rows=1 width=8) Filter: non_part2.e - -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..4.29 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=1) - -> Seq Scan on non_part2 (cost=0.00..4.25 rows=1 width=8) (actual time=0.004..0.005 rows=1 loops=1) + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..4.29 rows=1 width=8) + -> Seq Scan on non_part2 (cost=0.00..4.25 rows=1 width=8) Filter: (f = 10) - -> Materialize (cost=0.00..9.50 rows=100 width=0) (actual time=1.557..1.557 rows=1 loops=1) - -> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..8.00 rows=100 width=0) (actual time=1.531..1.541 rows=100 loops=1) - -> Seq Scan on non_part1 (cost=0.00..4.00 rows=34 width=0) (actual time=0.003..0.008 rows=38 loops=1) - Planning time: 1.810 ms - (slice0) Executor memory: 284K bytes. - (slice1) Executor memory: 60K bytes avg x 3 workers, 60K bytes max (seg0). - (slice2) Executor memory: 60K bytes avg x 3 workers, 60K bytes max (seg0). - (slice3) Executor memory: 2384K bytes avg x 3 workers, 2384K bytes max (seg0). Work_mem: 1K bytes max. - Memory used: 128000kB + -> Materialize (cost=0.00..9.50 rows=100 width=0) + -> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..8.00 rows=100 width=0) + -> Seq Scan on non_part1 (cost=0.00..4.00 rows=34 width=0) Optimizer: Postgres query optimizer - Execution time: 3.919 ms -(46 rows) +(39 rows) SELECT *, a IN ( SELECT b + 1 FROM non_part1) FROM ds_part, non_part2 WHERE ds_part.c = non_part2.e AND non_part2.f = 10 AND a IN ( SELECT b FROM non_part1); a | b | c | e | f | ?column? @@ -11672,8 +11716,8 @@ EXPLAIN SELECT * FROM varchar_sc_array_cmp t1, varchar_sc_array_cmp t2 where t1. SELECT * FROM varchar_sc_array_cmp t1, varchar_sc_array_cmp t2 where t1.a = t2.a and t1.a in ('b', 'c'); a | a ---+--- - b | b c | c + b | b (2 rows) SET optimizer_array_constraints=on; @@ -11693,9 +11737,9 @@ EXPLAIN SELECT * FROM varchar_sc_array_cmp t1, varchar_sc_array_cmp t2 where t1. SELECT * FROM varchar_sc_array_cmp t1, varchar_sc_array_cmp t2 where t1.a = t2.a and (t1.a in ('b', 'c') OR t1.a = 'a'); a | a ---+--- + b | b a | a c | c - b | b (3 rows) DROP TABLE varchar_sc_array_cmp; @@ -11774,10 +11818,10 @@ insert into tt values (1, 'b'), (1, 'B'); select * from tc, tt where c = v; a | c | b | v ---+---+---+--- - 1 | b | 1 | b 1 | a | 1 | a 1 | A | 1 | A 1 | B | 1 | B + 1 | b | 1 | b (4 rows) -- test gpexpand phase 1 @@ -11981,12 +12025,12 @@ analyze part2_1_prt_2; explain select * from part1, part2 where part1.b = part2.b limit 5; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- - Limit (cost=7528.75..7529.53 rows=5 width=16) - -> Gather Motion 3:1 (slice3; segments: 3) (cost=7528.75..7529.53 rows=5 width=16) - -> Limit (cost=7528.75..7529.43 rows=2 width=16) + Limit (cost=410984.11..410984.89 rows=5 width=16) + -> Gather Motion 3:1 (slice1; segments: 3) (cost=410984.11..410984.89 rows=5 width=16) + -> Limit (cost=410984.11..410984.79 rows=2 width=16) -> Hash Join (cost=7528.75..4042082.35 rows=9947454 width=16) Hash Cond: (part1_1_prt_1.b = part2_1_prt_1.b) - -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..5402.00 rows=57734 width=8) + -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..5402.00 rows=57734 width=8) Hash Key: part1_1_prt_1.b -> Append (cost=0.00..1938.00 rows=57734 width=8) -> Seq Scan on part1_1_prt_1 (cost=0.00..8.00 rows=167 width=8) @@ -11994,7 +12038,7 @@ explain select * from part1, part2 where part1.b = part2.b limit 5; -> Seq Scan on part1_1_prt_3 (cost=0.00..961.00 rows=28700 width=8) -> Seq Scan on part1_1_prt_4 (cost=0.00..961.00 rows=28700 width=8) -> Hash (cost=5375.00..5375.00 rows=57434 width=8) - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..5375.00 rows=57434 width=8) + -> Redistribute Motion 3:3 (slice3; segments: 3) (cost=0.00..5375.00 rows=57434 width=8) Hash Key: part2_1_prt_1.b -> Append (cost=0.00..1929.00 rows=57434 width=8) -> Seq Scan on part2_1_prt_1 (cost=0.00..3.50 rows=17 width=8) @@ -12005,19 +12049,6 @@ explain select * from part1, part2 where part1.b = part2.b limit 5; (21 rows) -- test opfamily handling in ORCA --- start_ignore -DROP FUNCTION abseq(int, int) CASCADE; -NOTICE: drop cascades to 4 other objects -DETAIL: drop cascades to operator |=|(integer,integer) -drop cascades to operator class abs_int_btree_ops for access method btree -drop cascades to operator class abs_int_hash_ops for access method hash -drop cascades to table abs_opclass_test -DROP FUNCTION abslt(int, int) CASCADE; -NOTICE: drop cascades to operator |<|(integer,integer) -DROP FUNCTION absgt(int, int) CASCADE; -NOTICE: drop cascades to operator |>|(integer,integer) -DROP FUNCTION abscmp(int, int) CASCADE; --- end_ignore CREATE FUNCTION abseq(int, int) RETURNS BOOL AS $$ begin return abs($1) = abs($2); end; @@ -12075,7 +12106,7 @@ EXPLAIN SELECT a, b FROM atab_old_hash INNER JOIN btab_old_hash ON a |=| b; (8 rows) SELECT a, b FROM atab_old_hash INNER JOIN btab_old_hash ON a |=| b; -ERROR: could not find hash function for hash operator 107857 (nodeHash.c:392) (seg0 slice2 127.0.1.1:6002 pid=663317) (nodeHash.c:392) +ERROR: could not find hash function for hash operator 73890 (nodeHash.c:389) (seg0 slice2 127.0.0.1:6002 pid=18942) (nodeHash.c:389) CREATE OPERATOR CLASS abs_int_hash_ops FOR TYPE int4 USING hash AS OPERATOR 1 |=|, @@ -12106,11 +12137,11 @@ EXPLAIN SELECT a, b FROM atab_old_hash INNER JOIN btab_old_hash ON a |=| b; SELECT a, b FROM atab_old_hash INNER JOIN btab_old_hash ON a |=| b; a | b ----+---- - -1 | -1 - -1 | 1 0 | 0 - 1 | -1 1 | 1 + 1 | -1 + -1 | 1 + -1 | -1 (5 rows) EXPLAIN SELECT a, b FROM btab_old_hash LEFT OUTER JOIN atab_old_hash ON a |=| b; @@ -12133,11 +12164,11 @@ SELECT a, b FROM btab_old_hash LEFT OUTER JOIN atab_old_hash ON a |=| b; a | b ----+---- | 2 - -1 | 1 - -1 | -1 0 | 0 - 1 | 1 1 | -1 + 1 | 1 + -1 | -1 + -1 | 1 (6 rows) set optimizer_expand_fulljoin = on; @@ -12193,9 +12224,9 @@ set optimizer_join_order=query; -- we ignore enable/disable_xform statements as their output will differ if the server is compiled without Orca (the xform won't exist) -- start_ignore select disable_xform('CXformInnerJoin2HashJoin'); - disable_xform ---------------------------------------- - Server has been compiled without ORCA + disable_xform +-------------------------------------- + CXformInnerJoin2HashJoin is disabled (1 row) -- end_ignore @@ -12228,9 +12259,9 @@ SELECT 1 FROM foo1, foo2 WHERE foo1.a = foo2.a AND foo2.c = 3 AND foo2.b IN (SEL reset optimizer_join_order; -- start_ignore select enable_xform('CXformInnerJoin2HashJoin'); - enable_xform ---------------------------------------- - Server has been compiled without ORCA + enable_xform +------------------------------------- + CXformInnerJoin2HashJoin is enabled (1 row) -- end_ignore @@ -12269,7 +12300,7 @@ HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sur -> Result (cost=0.00..0.01 rows=1 width=0) Output: '2020-01-01', '99' Optimizer: Postgres query optimizer - Settings: optimizer_join_order=query + Settings: optimizer=off, optimizer_enable_dynamicbitmapscan=on, optimizer_join_order=query (16 rows) CREATE TABLE TP AS @@ -12314,8 +12345,8 @@ explain select * from lossycastrangepart where b::int = 10; select * from lossycastrangepart where b::int = 10; a | b ------+------ - 9.9 | 9.9 10.1 | 10.1 + 9.9 | 9.9 (2 rows) explain select * from lossycastrangepart where b::int = 11; @@ -12337,8 +12368,8 @@ explain select * from lossycastrangepart where b::int = 11; select * from lossycastrangepart where b::int = 11; a | b ------+------ - 11.1 | 11.1 10.9 | 10.9 + 11.1 | 11.1 (2 rows) explain select * from lossycastrangepart where b::int < 10; @@ -12360,8 +12391,8 @@ explain select * from lossycastrangepart where b::int < 10; select * from lossycastrangepart where b::int < 10; a | b -----+----- - 9.1 | 9.1 5.1 | 5.1 + 9.1 | 9.1 (2 rows) explain select * from lossycastrangepart where b::int < 11; @@ -12384,9 +12415,9 @@ select * from lossycastrangepart where b::int < 11; a | b ------+------ 9.9 | 9.9 + 9.1 | 9.1 5.1 | 5.1 10.1 | 10.1 - 9.1 | 9.1 (4 rows) create table lossycastlistpart( a int, b float) partition by list(b) (partition l1 values(1.7, 2.1), partition l2 values(1.3, 2.7), partition l3 values(1.8, 2.8)); @@ -12538,7 +12569,7 @@ select * from tcorr1 out where out.b in (select coalesce(tcorr2.a, 99) from tcorr1 left outer join tcorr2 on tcorr1.a=tcorr2.a+out.a); -ERROR: Passing parameters across motion is not supported. (cdbmutate.c:3712) +ERROR: Passing parameters across motion is not supported. (cdbmutate.c:3703) -- expect 1 row -- FIXME: A process terminates during execution, see https://github.com/greenplum-db/gpdb/issues/10791 -- select * @@ -12632,7 +12663,7 @@ select * from tcorr1 out where out.b in (select coalesce(tcorr2.a, 99) from tcorr1 left outer join tcorr2 on tcorr1.a=tcorr2.a+out.a); -ERROR: Passing parameters across motion is not supported. (cdbmutate.c:3712) +ERROR: Passing parameters across motion is not supported. (cdbmutate.c:3703) -- expect 1 row -- FIXME: A process terminates during execution, see https://github.com/greenplum-db/gpdb/issues/10791 -- select * @@ -12800,13 +12831,13 @@ select * from foo join tbtree on foo.a=tbtree.a; 4000 | 4000 | 4000 | 4000 | 4000 | 4000 9000 | 9000 | 9000 | 9000 | 9000 | 9000 10000 | 10000 | 10000 | 10000 | 10000 | 10000 - 5000 | 5000 | 5000 | 5000 | 5000 | 5000 1000 | 1000 | 1000 | 1000 | 1000 | 1000 2000 | 2000 | 2000 | 2000 | 2000 | 2000 6000 | 6000 | 6000 | 6000 | 6000 | 6000 7000 | 7000 | 7000 | 7000 | 7000 | 7000 8000 | 8000 | 8000 | 8000 | 8000 | 8000 2000 | 2000 | 2000 | 2000 | -1 | -1 + 5000 | 5000 | 5000 | 5000 | 5000 | 5000 (11 rows) -- 2 simple bitmap @@ -12830,39 +12861,41 @@ select * from foo join tbitmap on foo.a=tbitmap.a; 4000 | 4000 | 4000 | 4000 | 4000 | 4000 9000 | 9000 | 9000 | 9000 | 9000 | 9000 10000 | 10000 | 10000 | 10000 | 10000 | 10000 + 5000 | 5000 | 5000 | 5000 | 5000 | 5000 1000 | 1000 | 1000 | 1000 | 1000 | 1000 2000 | 2000 | 2000 | 2000 | 2000 | 2000 6000 | 6000 | 6000 | 6000 | 6000 | 6000 7000 | 7000 | 7000 | 7000 | 7000 | 7000 8000 | 8000 | 8000 | 8000 | 8000 | 8000 2000 | 2000 | 2000 | 2000 | -1 | -1 - 5000 | 5000 | 5000 | 5000 | 5000 | 5000 (11 rows) -- 3 btree with select pred explain (costs off) select * from foo join tbtree on foo.a=tbtree.a where tbtree.a < 5000; - QUERY PLAN ------------------------------------------- + QUERY PLAN +------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) -> Hash Join Hash Cond: (tbtree.a = foo.a) - -> Seq Scan on tbtree - Filter: (a < 5000) + -> Bitmap Heap Scan on tbtree + Recheck Cond: (a < 5000) + -> Bitmap Index Scan on tbtreexa + Index Cond: (a < 5000) -> Hash -> Seq Scan on foo Filter: (a < 5000) Optimizer: Postgres query optimizer -(9 rows) +(11 rows) select * from foo join tbtree on foo.a=tbtree.a where tbtree.a < 5000; a | b | c | a | b | c ------+------+------+------+------+------ - 3000 | 3000 | 3000 | 3000 | 3000 | 3000 - 4000 | 4000 | 4000 | 4000 | 4000 | 4000 1000 | 1000 | 1000 | 1000 | 1000 | 1000 2000 | 2000 | 2000 | 2000 | 2000 | 2000 2000 | 2000 | 2000 | 2000 | -1 | -1 + 3000 | 3000 | 3000 | 3000 | 3000 | 3000 + 4000 | 4000 | 4000 | 4000 | 4000 | 4000 (5 rows) -- 4 bitmap with select pred @@ -12908,6 +12941,7 @@ select * from foo join (select a, b+c as bc from tbtree) proj on foo.a=proj.a; select * from foo join (select a, b+c as bc from tbtree) proj on foo.a=proj.a; a | b | c | a | bc -------+-------+-------+-------+------- + 5000 | 5000 | 5000 | 5000 | 10000 3000 | 3000 | 3000 | 3000 | 6000 4000 | 4000 | 4000 | 4000 | 8000 9000 | 9000 | 9000 | 9000 | 18000 @@ -12918,7 +12952,6 @@ select * from foo join (select a, b+c as bc from tbtree) proj on foo.a=proj.a; 7000 | 7000 | 7000 | 7000 | 14000 8000 | 8000 | 8000 | 8000 | 16000 2000 | 2000 | 2000 | 2000 | -2 - 5000 | 5000 | 5000 | 5000 | 10000 (11 rows) -- 6 bitmap with project @@ -12942,13 +12975,13 @@ select * from foo join (select a, b+c as bc from tbitmap) proj on foo.a=proj.a; 4000 | 4000 | 4000 | 4000 | 8000 9000 | 9000 | 9000 | 9000 | 18000 10000 | 10000 | 10000 | 10000 | 20000 + 5000 | 5000 | 5000 | 5000 | 10000 1000 | 1000 | 1000 | 1000 | 2000 2000 | 2000 | 2000 | 2000 | 4000 6000 | 6000 | 6000 | 6000 | 12000 7000 | 7000 | 7000 | 7000 | 14000 8000 | 8000 | 8000 | 8000 | 16000 2000 | 2000 | 2000 | 2000 | -2 - 5000 | 5000 | 5000 | 5000 | 10000 (11 rows) -- 7 btree with grby @@ -13003,42 +13036,44 @@ select * from foo join (select a, count(*) as cnt from tbitmap group by a) grby select * from foo join (select a, count(*) as cnt from tbitmap group by a) grby on foo.a=grby.a; a | b | c | a | cnt -------+-------+-------+-------+----- + 4000 | 4000 | 4000 | 4000 | 1 + 9000 | 9000 | 9000 | 9000 | 1 + 10000 | 10000 | 10000 | 10000 | 1 + 3000 | 3000 | 3000 | 3000 | 1 8000 | 8000 | 8000 | 8000 | 1 7000 | 7000 | 7000 | 7000 | 1 6000 | 6000 | 6000 | 6000 | 1 2000 | 2000 | 2000 | 2000 | 2 1000 | 1000 | 1000 | 1000 | 1 - 4000 | 4000 | 4000 | 4000 | 1 - 9000 | 9000 | 9000 | 9000 | 1 - 10000 | 10000 | 10000 | 10000 | 1 - 3000 | 3000 | 3000 | 3000 | 1 5000 | 5000 | 5000 | 5000 | 1 (10 rows) -- 9 btree with proj select grby select explain (costs off) select * from foo join (select a, count(*) + 5 as cnt from tbtree where tbtree.a < 5000 group by a having count(*) < 2) proj_sel_grby_sel on foo.a=proj_sel_grby_sel.a; - QUERY PLAN ------------------------------------------- + QUERY PLAN +------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) -> Hash Join Hash Cond: (tbtree.a = foo.a) -> HashAggregate Group Key: tbtree.a Filter: (count(*) < 2) - -> Seq Scan on tbtree - Filter: (a < 5000) + -> Bitmap Heap Scan on tbtree + Recheck Cond: (a < 5000) + -> Bitmap Index Scan on tbtreexa + Index Cond: (a < 5000) -> Hash -> Seq Scan on foo Optimizer: Postgres query optimizer -(11 rows) +(13 rows) select * from foo join (select a, count(*) + 5 as cnt from tbtree where tbtree.a < 5000 group by a having count(*) < 2) proj_sel_grby_sel on foo.a=proj_sel_grby_sel.a; a | b | c | a | cnt ------+------+------+------+----- - 1000 | 1000 | 1000 | 1000 | 6 4000 | 4000 | 4000 | 4000 | 6 3000 | 3000 | 3000 | 3000 | 6 + 1000 | 1000 | 1000 | 1000 | 6 (3 rows) -- 10 bitmap with proj select grby select @@ -13062,9 +13097,9 @@ select * from foo join (select a, count(*) + 5 as cnt from tbitmap where tbitmap select * from foo join (select a, count(*) + 5 as cnt from tbitmap where tbitmap.a < 5000 group by a having count(*) < 2) proj_sel_grby_sel on foo.a=proj_sel_grby_sel.a; a | b | c | a | cnt ------+------+------+------+----- - 1000 | 1000 | 1000 | 1000 | 6 4000 | 4000 | 4000 | 4000 | 6 3000 | 3000 | 3000 | 3000 | 6 + 1000 | 1000 | 1000 | 1000 | 6 (3 rows) -- 11 bitmap with two groupbys @@ -13089,16 +13124,16 @@ select * from foo join (select a, count(*) as cnt from (select distinct a, b fro select * from foo join (select a, count(*) as cnt from (select distinct a, b from tbitmap) grby1 group by a) grby2 on foo.a=grby2.a; a | b | c | a | cnt -------+-------+-------+-------+----- + 9000 | 9000 | 9000 | 9000 | 1 + 10000 | 10000 | 10000 | 10000 | 1 + 4000 | 4000 | 4000 | 4000 | 1 + 3000 | 3000 | 3000 | 3000 | 1 5000 | 5000 | 5000 | 5000 | 1 2000 | 2000 | 2000 | 2000 | 2 7000 | 7000 | 7000 | 7000 | 1 1000 | 1000 | 1000 | 1000 | 1 8000 | 8000 | 8000 | 8000 | 1 6000 | 6000 | 6000 | 6000 | 1 - 9000 | 9000 | 9000 | 9000 | 1 - 10000 | 10000 | 10000 | 10000 | 1 - 4000 | 4000 | 4000 | 4000 | 1 - 3000 | 3000 | 3000 | 3000 | 1 (10 rows) -- 12 btree with proj select 2*grby select @@ -13106,8 +13141,8 @@ explain (costs off) select * from foo join (select a, count(*) + cnt1 as cnt2 from (select a, count(*) as cnt1 from tbtree group by a) grby1 where grby1.a < 5000 group by a, cnt1 having count(*) < 2) proj_sel_grby_sel on foo.a=proj_sel_grby_sel.a; - QUERY PLAN ----------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) -> Hash Join Hash Cond: (proj_sel_grby_sel.a = foo.a) @@ -13117,22 +13152,24 @@ select * from foo join (select a, count(*) + cnt1 as cnt2 from (select a, count( Filter: (count(*) < 2) -> HashAggregate Group Key: tbtree.a - -> Seq Scan on tbtree - Filter: (a < 5000) + -> Bitmap Heap Scan on tbtree + Recheck Cond: (a < 5000) + -> Bitmap Index Scan on tbtreexa + Index Cond: (a < 5000) -> Hash -> Seq Scan on foo Optimizer: Postgres query optimizer -(14 rows) +(16 rows) select * from foo join (select a, count(*) + cnt1 as cnt2 from (select a, count(*) as cnt1 from tbtree group by a) grby1 where grby1.a < 5000 group by a, cnt1 having count(*) < 2) proj_sel_grby_sel on foo.a=proj_sel_grby_sel.a; a | b | c | a | cnt2 ------+------+------+------+------ - 4000 | 4000 | 4000 | 4000 | 2 - 3000 | 3000 | 3000 | 3000 | 2 2000 | 2000 | 2000 | 2000 | 3 1000 | 1000 | 1000 | 1000 | 2 + 4000 | 4000 | 4000 | 4000 | 2 + 3000 | 3000 | 3000 | 3000 | 2 (4 rows) -- 13 join pred accesses a projected column - no index scan @@ -13370,25 +13407,25 @@ explain (costs off) select * from tpart_dim d join tpart_ao_btree f on d.a=f.a w select disable_xform('CXformSelect2BitmapBoolOp'); disable_xform --------------------------------------- - Server has been compiled without ORCA + CXformSelect2BitmapBoolOp is disabled (1 row) select disable_xform('CXformSelect2DynamicBitmapBoolOp'); - disable_xform ---------------------------------------- - Server has been compiled without ORCA + disable_xform +---------------------------------------------- + CXformSelect2DynamicBitmapBoolOp is disabled (1 row) select disable_xform('CXformJoin2BitmapIndexGetApply'); - disable_xform ---------------------------------------- - Server has been compiled without ORCA + disable_xform +-------------------------------------------- + CXformJoin2BitmapIndexGetApply is disabled (1 row) select disable_xform('CXformInnerJoin2NLJoin'); - disable_xform ---------------------------------------- - Server has been compiled without ORCA + disable_xform +------------------------------------ + CXformInnerJoin2NLJoin is disabled (1 row) -- Make sure we don't allow a regular (btree) index scan or index join for an AO table @@ -13431,27 +13468,27 @@ select * from tpart_dim d join tpart_ao_btree f on d.a=f.a where d.b=1; (1 row) select enable_xform('CXformSelect2BitmapBoolOp'); - enable_xform ---------------------------------------- - Server has been compiled without ORCA + enable_xform +-------------------------------------- + CXformSelect2BitmapBoolOp is enabled (1 row) select enable_xform('CXformSelect2DynamicBitmapBoolOp'); - enable_xform ---------------------------------------- - Server has been compiled without ORCA + enable_xform +--------------------------------------------- + CXformSelect2DynamicBitmapBoolOp is enabled (1 row) select enable_xform('CXformJoin2BitmapIndexGetApply'); - enable_xform ---------------------------------------- - Server has been compiled without ORCA + enable_xform +------------------------------------------- + CXformJoin2BitmapIndexGetApply is enabled (1 row) select enable_xform('CXformInnerJoin2NLJoin'); - enable_xform ---------------------------------------- - Server has been compiled without ORCA + enable_xform +----------------------------------- + CXformInnerJoin2NLJoin is enabled (1 row) -- test casting with setops @@ -13559,7 +13596,8 @@ and first_id in (select first_id from mat_w); Output: material_test_1.first_id Filter: (material_test_1.second_id = ANY ('{1,2,3,4}'::integer[])) Optimizer: Postgres query optimizer -(22 rows) + Settings: enable_seqscan=on, optimizer=off +(23 rows) with mat_w as ( select first_id @@ -13572,14 +13610,14 @@ where first_id in (select first_id from mat_w) and first_id in (select first_id from mat_w); first_id ---------- - 1 - 1 2 3 4 2 3 4 + 1 + 1 (8 rows) reset optimizer_enable_indexscan; @@ -13621,7 +13659,8 @@ from mat m1 join mat m2 on m1.j = m2.j; -> Bitmap Index Scan on material_bitmapscan_idx (cost=0.00..102.66 rows=334 width=0) Index Cond: (material_bitmapscan_1.k = 'Thu Jun 03 00:00:00 2021'::timestamp without time zone) Optimizer: Postgres query optimizer -(22 rows) + Settings: optimizer=off +(23 rows) with mat as( select i, j from material_bitmapscan where i = 2 and j = 2 @@ -13674,16 +13713,16 @@ set enable_hashjoin=off; explain select r.a, r.b, r.c, l.c from left_outer_index_nl_foo r left outer join left_outer_index_nl_bar l on r.b=l.b; QUERY PLAN ---------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..4.58 rows=4 width=16) - -> Nested Loop Left Join (cost=0.00..4.58 rows=2 width=16) + Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..5.58 rows=4 width=16) + -> Nested Loop Left Join (cost=0.00..5.58 rows=2 width=16) Join Filter: (r.b = l.b) -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..2.12 rows=2 width=12) Hash Key: r.b -> Seq Scan on left_outer_index_nl_foo r (cost=0.00..2.04 rows=2 width=12) - -> Materialize (cost=0.00..2.17 rows=2 width=8) - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..2.15 rows=2 width=8) + -> Materialize (cost=0.00..3.17 rows=2 width=8) + -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..3.15 rows=2 width=8) Hash Key: l.b - -> Seq Scan on left_outer_index_nl_bar l (cost=0.00..2.05 rows=2 width=8) + -> Seq Scan on left_outer_index_nl_bar l (cost=0.00..3.05 rows=2 width=8) Optimizer: Postgres query optimizer (11 rows) @@ -13711,26 +13750,26 @@ analyze left_outer_index_nl_bar_hash; explain select r.a, r.b, r.c, l.c from left_outer_index_nl_foo_hash r left outer join left_outer_index_nl_bar l on r.b=l.b; QUERY PLAN ---------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..4.58 rows=4 width=14) - -> Nested Loop Left Join (cost=0.00..4.58 rows=2 width=14) + Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..5.58 rows=4 width=14) + -> Nested Loop Left Join (cost=0.00..5.58 rows=2 width=14) Join Filter: (r.b = l.b) -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..2.12 rows=2 width=10) Hash Key: r.b -> Seq Scan on left_outer_index_nl_foo_hash r (cost=0.00..2.04 rows=2 width=10) - -> Materialize (cost=0.00..2.17 rows=2 width=8) - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..2.15 rows=2 width=8) + -> Materialize (cost=0.00..3.17 rows=2 width=8) + -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..3.15 rows=2 width=8) Hash Key: l.b - -> Seq Scan on left_outer_index_nl_bar l (cost=0.00..2.05 rows=2 width=8) + -> Seq Scan on left_outer_index_nl_bar l (cost=0.00..3.05 rows=2 width=8) Optimizer: Postgres query optimizer (11 rows) select r.a, r.b, r.c, l.c from left_outer_index_nl_foo_hash r left outer join left_outer_index_nl_bar l on r.b=l.b; a | b | c | c ---+---+---+--- - 1 | 1 | 1 | 2 | 2 | 2 | 2 3 | 3 | 3 | 3 4 | 4 | 4 | 4 + 1 | 1 | 1 | (4 rows) --- verify that a motion is introduced such that joins on each segment are internal to that segment (distributed by join key) @@ -13829,13 +13868,13 @@ ANALYZE tt2; EXPLAIN SELECT b FROM tt1 WHERE NOT EXISTS (SELECT * FROM tt2 WHERE (tt2.d = tt1.b) IS DISTINCT FROM false); QUERY PLAN ------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice2; segments: 3) (cost=10000000000.00..10000000005.06 rows=4 width=4) - -> Nested Loop Anti Join (cost=10000000000.00..10000000005.06 rows=2 width=4) + Gather Motion 3:1 (slice1; segments: 3) (cost=10000000000.00..10000000002.56 rows=3 width=4) + -> Nested Loop Anti Join (cost=10000000000.00..10000000002.52 rows=1 width=4) Join Filter: ((tt2.d = tt1.b) IS DISTINCT FROM false) - -> Seq Scan on tt1 (cost=0.00..2.04 rows=2 width=4) - -> Materialize (cost=0.00..2.26 rows=4 width=4) - -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..2.20 rows=4 width=4) - -> Seq Scan on tt2 (cost=0.00..2.04 rows=2 width=4) + -> Seq Scan on tt1 (cost=0.00..1.01 rows=1 width=4) + -> Materialize (cost=0.00..1.09 rows=4 width=4) + -> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..1.07 rows=4 width=4) + -> Seq Scan on tt2 (cost=0.00..1.01 rows=1 width=4) Optimizer: Postgres query optimizer (8 rows) @@ -13847,13 +13886,13 @@ SELECT b FROM tt1 WHERE NOT EXISTS (SELECT * FROM tt2 WHERE (tt2.d = tt1.b) IS D EXPLAIN SELECT b FROM tt1 WHERE NOT EXISTS (SELECT * FROM tt2 WHERE (tt2.d = tt1.b) IS DISTINCT FROM true); QUERY PLAN ------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice2; segments: 3) (cost=10000000000.00..10000000005.06 rows=4 width=4) - -> Nested Loop Anti Join (cost=10000000000.00..10000000005.06 rows=2 width=4) + Gather Motion 3:1 (slice1; segments: 3) (cost=10000000000.00..10000000002.56 rows=3 width=4) + -> Nested Loop Anti Join (cost=10000000000.00..10000000002.52 rows=1 width=4) Join Filter: ((tt2.d = tt1.b) IS DISTINCT FROM true) - -> Seq Scan on tt1 (cost=0.00..2.04 rows=2 width=4) - -> Materialize (cost=0.00..2.26 rows=4 width=4) - -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..2.20 rows=4 width=4) - -> Seq Scan on tt2 (cost=0.00..2.04 rows=2 width=4) + -> Seq Scan on tt1 (cost=0.00..1.01 rows=1 width=4) + -> Materialize (cost=0.00..1.09 rows=4 width=4) + -> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..1.07 rows=4 width=4) + -> Seq Scan on tt2 (cost=0.00..1.01 rows=1 width=4) Optimizer: Postgres query optimizer (8 rows) @@ -13865,13 +13904,13 @@ SELECT b FROM tt1 WHERE NOT EXISTS (SELECT * FROM tt2 WHERE (tt2.d = tt1.b) IS D EXPLAIN SELECT b FROM tt1 WHERE NOT EXISTS (SELECT * FROM tt2 WHERE (tt1.b = tt2.d) IS DISTINCT FROM NULL); QUERY PLAN ------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice2; segments: 3) (cost=10000000000.00..10000000005.06 rows=4 width=4) - -> Nested Loop Anti Join (cost=10000000000.00..10000000005.06 rows=2 width=4) - Join Filter: ((tt1.b = tt2.d) IS DISTINCT FROM NULL::boolean) - -> Seq Scan on tt1 (cost=0.00..2.04 rows=2 width=4) - -> Materialize (cost=0.00..2.26 rows=4 width=4) - -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..2.20 rows=4 width=4) - -> Seq Scan on tt2 (cost=0.00..2.04 rows=2 width=4) + Gather Motion 3:1 (slice1; segments: 3) (cost=10000000000.00..10000000002.52 rows=3 width=4) + -> Nested Loop Anti Join (cost=10000000000.00..10000000002.47 rows=1 width=4) + Join Filter: ((tt1.b = tt2.d) IS NOT NULL) + -> Seq Scan on tt1 (cost=0.00..1.01 rows=1 width=4) + -> Materialize (cost=0.00..1.09 rows=4 width=4) + -> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..1.07 rows=4 width=4) + -> Seq Scan on tt2 (cost=0.00..1.01 rows=1 width=4) Optimizer: Postgres query optimizer (8 rows) @@ -13924,16 +13963,16 @@ EXPLAIN (COSTS OFF) SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.a SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.a; a | b | c | a | b | c ----+----+----+----+----+---- + 5 | 5 | 5 | 5 | 5 | 5 + 6 | 6 | 6 | 6 | 6 | 6 + 9 | 9 | 9 | 9 | 9 | 9 + 10 | 10 | 10 | 10 | 10 | 10 2 | 2 | 2 | 2 | 2 | 2 3 | 3 | 3 | 3 | 3 | 3 4 | 4 | 4 | 4 | 4 | 4 7 | 7 | 7 | 7 | 7 | 7 8 | 8 | 8 | 8 | 8 | 8 1 | 1 | 1 | 1 | 1 | 1 - 5 | 5 | 5 | 5 | 5 | 5 - 6 | 6 | 6 | 6 | 6 | 6 - 9 | 9 | 9 | 9 | 9 | 9 - 10 | 10 | 10 | 10 | 10 | 10 (10 rows) --- if the inner child is not distributed on the join column, orca should @@ -13984,15 +14023,15 @@ EXPLAIN (COSTS OFF) SELECT * FROM tone t1 LEFT OUTER JOIN (SELECT 1+t2.b as b fr SELECT * FROM tone t1 LEFT OUTER JOIN (SELECT 1+t2.b as b from tone t2) t2 ON t1.a = t2.b; a | b | c | b ----+----+----+---- - 5 | 5 | 5 | 5 - 9 | 9 | 9 | 9 - 6 | 6 | 6 | 6 - 10 | 10 | 10 | 10 + 2 | 2 | 2 | 2 + 7 | 7 | 7 | 7 3 | 3 | 3 | 3 4 | 4 | 4 | 4 8 | 8 | 8 | 8 - 2 | 2 | 2 | 2 - 7 | 7 | 7 | 7 + 6 | 6 | 6 | 6 + 10 | 10 | 10 | 10 + 5 | 5 | 5 | 5 + 9 | 9 | 9 | 9 1 | 1 | 1 | (10 rows) @@ -14017,12 +14056,12 @@ SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.b+t2.a+1; 9 | 9 | 9 | 4 | 4 | 4 6 | 6 | 6 | | | 10 | 10 | 10 | | | - 3 | 3 | 3 | 1 | 1 | 1 + 1 | 1 | 1 | | | 7 | 7 | 7 | 3 | 3 | 3 + 3 | 3 | 3 | 1 | 1 | 1 8 | 8 | 8 | | | 4 | 4 | 4 | | | 2 | 2 | 2 | | | - 1 | 1 | 1 | | | (10 rows) --- send a broadcast request to the inner child where the inner side clause contains @@ -14044,15 +14083,15 @@ SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.b-t1.a; a | b | c | a | b | c ----+----+----+----+----+---- 1 | 1 | 1 | 2 | 2 | 2 + 5 | 5 | 5 | 10 | 10 | 10 + 6 | 6 | 6 | | | + 9 | 9 | 9 | | | + 10 | 10 | 10 | | | 2 | 2 | 2 | 4 | 4 | 4 3 | 3 | 3 | 6 | 6 | 6 4 | 4 | 4 | 8 | 8 | 8 7 | 7 | 7 | | | 8 | 8 | 8 | | | - 5 | 5 | 5 | 10 | 10 | 10 - 6 | 6 | 6 | | | - 9 | 9 | 9 | | | - 10 | 10 | 10 | | | (10 rows) --- orca should broadcast the inner child if the guc is set off @@ -14074,6 +14113,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.b SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.b; a | b | c | a | b | c ----+----+----+----+----+---- + 1 | 1 | 1 | 1 | 1 | 1 2 | 2 | 2 | 2 | 2 | 2 3 | 3 | 3 | 3 | 3 | 3 4 | 4 | 4 | 4 | 4 | 4 @@ -14083,7 +14123,6 @@ SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.b; 6 | 6 | 6 | 6 | 6 | 6 9 | 9 | 9 | 9 | 9 | 9 10 | 10 | 10 | 10 | 10 | 10 - 1 | 1 | 1 | 1 | 1 | 1 (10 rows) EXPLAIN (COSTS OFF) SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.a; @@ -14101,15 +14140,15 @@ EXPLAIN (COSTS OFF) SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.a SELECT * FROM tone t1 LEFT OUTER JOIN tone t2 ON t1.a = t2.a; a | b | c | a | b | c ----+----+----+----+----+---- + 5 | 5 | 5 | 5 | 5 | 5 + 6 | 6 | 6 | 6 | 6 | 6 + 9 | 9 | 9 | 9 | 9 | 9 + 10 | 10 | 10 | 10 | 10 | 10 2 | 2 | 2 | 2 | 2 | 2 3 | 3 | 3 | 3 | 3 | 3 4 | 4 | 4 | 4 | 4 | 4 7 | 7 | 7 | 7 | 7 | 7 8 | 8 | 8 | 8 | 8 | 8 - 5 | 5 | 5 | 5 | 5 | 5 - 6 | 6 | 6 | 6 | 6 | 6 - 9 | 9 | 9 | 9 | 9 | 9 - 10 | 10 | 10 | 10 | 10 | 10 1 | 1 | 1 | 1 | 1 | 1 (10 rows) @@ -14182,7 +14221,7 @@ select count(*) from (select trim( case when a!='abc' then (regexp_split_to_tab (1 row) select count(regexp_split_to_table((a)::text, ','::text)) from nested_srf; -ERROR: set-valued function called in context that cannot accept a set (seg2 slice1 127.0.1.1:6004 pid=663328) +ERROR: set-valued function called in context that cannot accept a set (seg2 slice1 127.0.0.1:6004 pid=17357) -- This produces wrong results on planner select count(*) from (select trim(coalesce(regexp_split_to_table((a)::text, ','::text),'')) from nested_srf)a; count @@ -14339,11 +14378,7 @@ select * from part_table13 where c=7; -- eval_const_expressions() call for subplan. ORCA has only one call to -- fold_constants() at the very beginning and doesn't perform folding later. CREATE TABLE join_null_rej1(i int); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. -HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. CREATE TABLE join_null_rej2(i int); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. -HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. INSERT INTO join_null_rej1(i) VALUES (1), (2), (3); INSERT INTO join_null_rej2 SELECT i FROM join_null_rej1; CREATE OR REPLACE FUNCTION join_null_rej_func() RETURNS int AS $$ @@ -14598,7 +14633,8 @@ explain verbose SELECT a IN (SELECT generate_series(1,a)) AS x FROM (SELECT gene -> Result (cost=0.00..5.01 rows=334 width=0) Output: generate_series(1, s.a) Optimizer: Postgres query optimizer -(8 rows) + Settings: optimizer=off +(9 rows) SELECT a IN (SELECT generate_series(1,a)) AS x FROM (SELECT generate_series(1, 3) AS a) AS s; x @@ -14627,7 +14663,8 @@ EXPLAIN (VERBOSE, COSTS OFF) -> Result Output: generate_series(1, "*VALUES*".column1) Optimizer: Postgres query optimizer -(7 rows) + Settings: optimizer=off +(8 rows) CREATE TABLE t_outer_srf (a int, b int) DISTRIBUTED BY (a); INSERT INTO t_outer_srf SELECT i, i+1 FROM generate_series(1,3) as i; @@ -14658,7 +14695,8 @@ EXPLAIN (VERBOSE, COSTS OFF) -> Broadcast Motion 3:3 (slice1; segments: 3) -> Seq Scan on orca.t_inner_srf Optimizer: Postgres query optimizer -(13 rows) + Settings: optimizer=off +(14 rows) DROP TABLE t_outer_srf, t_inner_srf; ------------------------------------------------------- @@ -14790,116 +14828,11 @@ explain (costs off) select (select b from subplan_test_1 where subplan_test_1.b= select (select b from subplan_test_1 where subplan_test_1.b=subplan_test_2.b) from subplan_test_2; b --- - 1 + 1 (5 rows) reset gp_max_slices; --- start_ignore -DROP SCHEMA orca CASCADE; -NOTICE: drop cascades to 186 other objects -DETAIL: drop cascades to table bar1 -drop cascades to table bar2 -drop cascades to table r -drop cascades to table s -drop cascades to table m -drop cascades to table m1 -drop cascades to table orca_w1 -drop cascades to table orca_w2 -drop cascades to table orca_w3 -drop cascades to table rcte -drop cascades to table onek -drop cascades to table pp -drop cascades to table multilevel_p -drop cascades to table t -drop cascades to table t_date -drop cascades to table t_text -drop cascades to type employee -drop cascades to function emp_equal(employee,employee) -drop cascades to operator =(employee,employee) -drop cascades to operator family employee_op_class for access method btree -drop cascades to table t_employee -drop cascades to table t_ceeval_ints -drop cascades to function csq_f(integer) -drop cascades to table csq_r -drop cascades to table fooh1 -drop cascades to table fooh2 -drop cascades to append only table t77 -drop cascades to table prod9 -drop cascades to table toanalyze -drop cascades to table ur -drop cascades to table us -drop cascades to table ut -drop cascades to table uu -drop cascades to table twf1 -drop cascades to table twf2 -drop cascades to table tab1 -drop cascades to table tab2 -drop cascades to function sum_sfunc(anyelement,anyelement) -drop cascades to function sum_combinefunc(anyelement,anyelement) -drop cascades to function myagg1(anyelement) -drop cascades to function sum_sfunc2(anyelement,anyelement,anyelement) -drop cascades to function myagg2(anyelement,anyelement) -drop cascades to function gptfp(anyarray,anyelement) -drop cascades to function gpffp(anyarray) -drop cascades to function myagg3(anyelement) -drop cascades to table array_table -drop cascades to table mpp22453 -drop cascades to table mpp22791 -drop cascades to table p1 -drop cascades to append only table tmp_verd_s_pp_provtabs_agt_0015_extract1 -drop cascades to table arrtest -drop cascades to table foo_missing_stats -drop cascades to table bar_missing_stats -drop cascades to table table_with_small_statistic_precision_diff -drop cascades to table cust -drop cascades to table datedim -drop cascades to function plusone(integer) -drop cascades to table bm_test -drop cascades to table bm_dyn_test -drop cascades to table bm_dyn_test_onepart -drop cascades to table bm_dyn_test_multilvl_part -drop cascades to table my_tt_agg_opt -drop cascades to table my_tq_agg_opt_part -drop cascades to function plusone(numeric) -drop cascades to table ggg -drop cascades to table t3 -drop cascades to table index_test -drop cascades to table btree_test -drop cascades to table bitmap_test -drop cascades to type rainbow -drop cascades to table foo_ctas -drop cascades to table input_tab1 -drop cascades to table input_tab2 -drop cascades to table tab_1 -drop cascades to table tab_2 -drop cascades to table tab_3 -drop cascades to table t_outer -drop cascades to table t_inner -drop cascades to table wst0 -drop cascades to table wst1 -drop cascades to table wst2 -drop cascades to table test1 -drop cascades to table t_new -drop cascades to table x_tab -drop cascades to table y_tab -drop cascades to table z_tab -drop cascades to function test_func_pg_stats() -drop cascades to type myint -drop cascades to function myintout(myint) -drop cascades to function myintin(cstring) -drop cascades to function myint_int8(myint) -drop cascades to table csq_cast_param_outer -drop cascades to table csq_cast_param_inner -drop cascades to function myint_numeric(myint) -drop cascades to cast from myint to numeric -drop cascades to table onetimefilter1 -drop cascades to table onetimefilter2 -drop cascades to table ffoo -drop cascades to table fbar -drop cascades to table touter -and 86 other objects (see server log for list) --- end_ignore diff --git a/src/test/regress/expected/vacuum_gp.out b/src/test/regress/expected/vacuum_gp.out index 95e80db5886..576642885eb 100644 --- a/src/test/regress/expected/vacuum_gp.out +++ b/src/test/regress/expected/vacuum_gp.out @@ -15,6 +15,8 @@ insert into ao_age_test select i, (i%123 > 50), (i/11) || '', '2008/10/12'::date + (i || ' days')::interval from generate_series(0, 99) i; create index ao_age_test_i on ao_age_test(i); +NOTICE: building index for child partition "ao_age_test_1_prt_b1" +NOTICE: building index for child partition "ao_age_test_1_prt_b2" -- MPP-23647 Create a empty table with no segments, let its age -- increase during the test. We will vacuum it at the end of the -- test. @@ -289,8 +291,6 @@ DROP ROLE r_priv_test; -- VACUUM and ANALYZE. set gp_autostats_mode='none'; CREATE TABLE vacuum_gp_pt (a int, b int) DISTRIBUTED BY (a) PARTITION BY range (b) (END(5), START(5)); -NOTICE: CREATE TABLE will create partition "vacuum_gp_pt_1_prt_1" for table "vacuum_gp_pt" -NOTICE: CREATE TABLE will create partition "vacuum_gp_pt_1_prt_2" for table "vacuum_gp_pt" INSERT INTO vacuum_gp_pt SELECT 0, 6 FROM generate_series(1, 12); SELECT relname, reltuples, relpages FROM pg_catalog.pg_class WHERE relname like 'vacuum_gp_pt%'; relname | reltuples | relpages @@ -338,19 +338,12 @@ WARNING: skipping "__gp_log_master_ext" --- cannot vacuum non-tables, external -- Vacuum related access control tests (Issue: https://github.com/greenplum-db/gpdb/issues/9001) -- Given a non-super-user role CREATE ROLE non_super_user_vacuum; -NOTICE: resource queue required -- using default resource queue "pg_default" -- And a heap table with auxiliary relations under the pg_toast namespace. CREATE TABLE vac_acl_heap(i int, j text); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. -HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -- And an AO table with auxiliary relations under the pg_aoseg namespace. CREATE TABLE vac_acl_ao(i int, j text) with (appendonly=true); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. -HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -- And an AOCS table with auxiliary relations under the pg_aocsseg namespace. CREATE TABLE vac_acl_aocs(i int, j text) with (appendonly=true, orientation=column); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. -HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -- And all the tables belong to the non-super-user role. ALTER TABLE vac_acl_heap OWNER TO non_super_user_vacuum; ALTER TABLE vac_acl_ao OWNER TO non_super_user_vacuum; @@ -387,9 +380,9 @@ ORDER BY gp_segment_id; gp_segment_id | relname | reltuples | relpages | age ---------------+------------------------+-----------+----------+----- -1 | vacuum_test_heap_table | 10 | 3 | 3 - 0 | vacuum_test_heap_table | 5 | 1 | 4 - 1 | vacuum_test_heap_table | 1 | 1 | 4 - 2 | vacuum_test_heap_table | 4 | 1 | 4 + 0 | vacuum_test_heap_table | 0 | 0 | 4 + 1 | vacuum_test_heap_table | 0 | 0 | 4 + 2 | vacuum_test_heap_table | 0 | 0 | 4 (4 rows) VACUUM FREEZE vacuum_test_heap_table; From f3bf88f98c5833f5b8af9d12a2aacd313e1dad25 Mon Sep 17 00:00:00 2001 From: Victor Kremensky Date: Tue, 29 Jul 2025 06:27:20 +0000 Subject: [PATCH 5/5] fix vacuum gp --- src/test/regress/expected/vacuum_gp.out | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/test/regress/expected/vacuum_gp.out b/src/test/regress/expected/vacuum_gp.out index 576642885eb..95e80db5886 100644 --- a/src/test/regress/expected/vacuum_gp.out +++ b/src/test/regress/expected/vacuum_gp.out @@ -15,8 +15,6 @@ insert into ao_age_test select i, (i%123 > 50), (i/11) || '', '2008/10/12'::date + (i || ' days')::interval from generate_series(0, 99) i; create index ao_age_test_i on ao_age_test(i); -NOTICE: building index for child partition "ao_age_test_1_prt_b1" -NOTICE: building index for child partition "ao_age_test_1_prt_b2" -- MPP-23647 Create a empty table with no segments, let its age -- increase during the test. We will vacuum it at the end of the -- test. @@ -291,6 +289,8 @@ DROP ROLE r_priv_test; -- VACUUM and ANALYZE. set gp_autostats_mode='none'; CREATE TABLE vacuum_gp_pt (a int, b int) DISTRIBUTED BY (a) PARTITION BY range (b) (END(5), START(5)); +NOTICE: CREATE TABLE will create partition "vacuum_gp_pt_1_prt_1" for table "vacuum_gp_pt" +NOTICE: CREATE TABLE will create partition "vacuum_gp_pt_1_prt_2" for table "vacuum_gp_pt" INSERT INTO vacuum_gp_pt SELECT 0, 6 FROM generate_series(1, 12); SELECT relname, reltuples, relpages FROM pg_catalog.pg_class WHERE relname like 'vacuum_gp_pt%'; relname | reltuples | relpages @@ -338,12 +338,19 @@ WARNING: skipping "__gp_log_master_ext" --- cannot vacuum non-tables, external -- Vacuum related access control tests (Issue: https://github.com/greenplum-db/gpdb/issues/9001) -- Given a non-super-user role CREATE ROLE non_super_user_vacuum; +NOTICE: resource queue required -- using default resource queue "pg_default" -- And a heap table with auxiliary relations under the pg_toast namespace. CREATE TABLE vac_acl_heap(i int, j text); +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. +HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -- And an AO table with auxiliary relations under the pg_aoseg namespace. CREATE TABLE vac_acl_ao(i int, j text) with (appendonly=true); +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. +HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -- And an AOCS table with auxiliary relations under the pg_aocsseg namespace. CREATE TABLE vac_acl_aocs(i int, j text) with (appendonly=true, orientation=column); +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. +HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -- And all the tables belong to the non-super-user role. ALTER TABLE vac_acl_heap OWNER TO non_super_user_vacuum; ALTER TABLE vac_acl_ao OWNER TO non_super_user_vacuum; @@ -380,9 +387,9 @@ ORDER BY gp_segment_id; gp_segment_id | relname | reltuples | relpages | age ---------------+------------------------+-----------+----------+----- -1 | vacuum_test_heap_table | 10 | 3 | 3 - 0 | vacuum_test_heap_table | 0 | 0 | 4 - 1 | vacuum_test_heap_table | 0 | 0 | 4 - 2 | vacuum_test_heap_table | 0 | 0 | 4 + 0 | vacuum_test_heap_table | 5 | 1 | 4 + 1 | vacuum_test_heap_table | 1 | 1 | 4 + 2 | vacuum_test_heap_table | 4 | 1 | 4 (4 rows) VACUUM FREEZE vacuum_test_heap_table;