cloudberry icon indicating copy to clipboard operation
cloudberry copied to clipboard

different plan when set the enable_parallel on REPLICATED table.

Open jiaqizho opened this issue 1 year ago • 0 comments

Apache Cloudberry version

No response

What happened

drop table if exists with_test2 cascade;
drop table if exists with_test3 cascade;
create table with_test2 (id bigserial NOT NULL, isc varchar(15) NOT NULL,iscd varchar(15) NULL) DISTRIBUTED REPLICATED;
create table with_test3 (id numeric NULL, rc varchar(255) NULL,ri numeric NULL) DISTRIBUTED REPLICATED;
insert into with_test2 (isc,iscd) values ('CMN_BIN_YES', 'CMN_BIN_YES');
insert into with_test3 (id,rc,ri) values (113551,'CMN_BIN_YES',101991), (113552,'CMN_BIN_NO',101991), (113553,'CMN_BIN_ERR',101991), (113554,'CMN_BIN_NULL',101991);
explain
WITH
    t1 AS (SELECT * FROM with_test2),
    t2 AS (SELECT id, rc FROM with_test3 WHERE ri = 101991)
SELECT p.*FROM t1 p JOIN t2 r ON p.isc = r.rc JOIN t2 r1 ON p.iscd = r1.rc LIMIT 1;

The result when enable_parallel turn on and off. image

This case has nothing to do with the table's statistics. Result after analyze: image

What you think should happen instead

No response

How to reproduce

pass

Operating System

any

Anything else

No response

Are you willing to submit PR?

  • [ ] Yes, I am willing to submit a PR!

Code of Conduct

jiaqizho avatar Dec 30 '24 09:12 jiaqizho