apache / apache/cloudberry

Enable partition selector in single node mode.

Open
#17 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.4k
Forks
247
Avg merge
4d 3h
Merged PRs (30d)
39

Description

When we create Cloudberry cluster in single node mode, partition selector is disabled.
We want to enable it so we could get following plan:

```
create table lprt_a (a int not null);
-- Insert some values we won't find in ab
insert into lprt_a select 0 from generate_series(1,100);
-- and insert some values that we should find.
insert into lprt_a values(1),(1);
analyze lprt_a;
create index ab_a2_b1_a_idx on ab_a2_b1 (a);
create index ab_a2_b2_a_idx on ab_a2_b2 (a);
create index ab_a2_b3_a_idx on ab_a2_b3 (a);
create index ab_a1_b1_a_idx on ab_a1_b1 (a);
create index ab_a1_b2_a_idx on ab_a1_b2 (a);
create index ab_a1_b3_a_idx on ab_a1_b3 (a);
create index ab_a3_b1_a_idx on ab_a3_b1 (a);
create index ab_a3_b2_a_idx on ab_a3_b2 (a);
create index ab_a3_b3_a_idx on ab_a3_b3 (a);
set enable_hashjoin = 0;
set enable_mergejoin = 0;
set enable_memoize = 0;
select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on ab.a = a.a where a.a in(0, 0, 1)');
explain_parallel_append
------------------------------------------------------------------------------------------------
Finalize Aggregate (actual rows=N loops=N)
-> Gather Motion 1:1 (slice1; segments: 1) (actual rows=N loops=N)
-> Partial Aggregate (actual rows=N loops=N)
-> Merge Join (never executed)
Merge Cond: (ab.a = a.a)
-> Sort (never executed)
Sort Key: ab.a
Sort Method: quicksort Memory: 50kB
-> Append (never executed)
Partition Selectors: $0
-> Bitmap Heap Scan on ab_a1_b1 ab_1 (never executed)
Recheck Cond: (a = ANY ('{0,0,1}'::integer[]))
-> Bitmap Index Scan on ab_a1_b1_a_idx (never executed)
Index Cond: (a = ANY ('{0,0,1}'::integer[]))
-> Bitmap Heap Scan on ab_a1_b2 ab_2 (never executed)
Recheck Cond: (a = ANY ('{0,0,1}'::integer[]))
-> Bitmap Index Scan on ab_a1_b2_a_idx (never executed)
Index Cond: (a = ANY ('{0,0,1}'::integer[]))
-> Bitmap Heap Scan on ab_a1_b3 ab_3 (never executed)
Recheck Cond: (a = ANY ('{0,0,1}'::integer[]))
-> Bitmap Index Scan on ab_a1_b3_a_idx (never executed)
Index Cond: (a = ANY ('{0,0,1}'::integer[]))
-> Sort (actual rows=N loops=N)
Sort Key: a.a
Sort Method: quicksort Memory: 60kB
-> Partition Selector (selector id: $0) (actual rows=N loops=N)
-> Seq Scan on lprt_a a (actual rows=N loops=N)
Filter: (a = ANY ('{0,0,1}'::integer[]))
Optimizer: Postgres query optimizer
```

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied single-node Cloudberry SQL reproduction and compare the resulting plan with the expected plan showing a Partition Selector. Trace the partition-selector behavior in single-node mode; done means the selector is enabled and the query produces the expected plan.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, postgresql, sql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.