Skip to content

[CBRD-26522] Support NL join during parallel heap scan#6806

Open
xmilex-git wants to merge 24 commits intoCUBRID:developfrom
xmilex-git:pnl_1
Open

[CBRD-26522] Support NL join during parallel heap scan#6806
xmilex-git wants to merge 24 commits intoCUBRID:developfrom
xmilex-git:pnl_1

Conversation

@xmilex-git
Copy link
Contributor

@xmilex-git xmilex-git commented Jan 28, 2026

http://jira.cubrid.org/browse/CBRD-26522

Purpose

기존에는 join driving 테이블이 heap scan인 경우, 이를 row-by-row로 처리하여 동기화 오버헤드 및 중앙 처리 방식으로 인해 NL join의 성능이 많이 저하됐었습니다.

이를 개선하기 위해, 각각의 parallel heap scan thread에서 NL join을 평가하고 결과를 각각 수집하게끔 변경하여, mergeable-list 방식으로 처리할 수 있도록 변경합니다.

@xmilex-git xmilex-git self-assigned this Jan 28, 2026
@xmilex-git
Copy link
Contributor Author

/run all

@xmilex-git
Copy link
Contributor Author

/run all

@xmilex-git xmilex-git changed the title [CBRD-00000] Parallel NL join [CBRD-26522] Support NL join during parallel heap scan Jan 29, 2026
@xmilex-git
Copy link
Contributor Author

/run all

@xmilex-git
Copy link
Contributor Author

/run all

@xmilex-git
Copy link
Contributor Author

/run all

@xmilex-git
Copy link
Contributor Author

/run all

@xmilex-git
Copy link
Contributor Author

/run all

@xmilex-git
Copy link
Contributor Author

/run all

@xmilex-git xmilex-git marked this pull request as ready for review February 4, 2026 08:37
@xmilex-git
Copy link
Contributor Author

/run all

@xmilex-git
Copy link
Contributor Author

/run shell

@xmilex-git
Copy link
Contributor Author

/run shell

1 similar comment
@xmilex-git
Copy link
Contributor Author

/run shell

}

/* for nl join */
for (xptr1 = xasl_tree->scan_ptr; xptr1 != nullptr; xptr1 = xptr1->scan_ptr)
Copy link
Contributor

@Hamkua Hamkua Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace 출력 시 partition 정보가 출력되지 않는 것 같습니다.

drop table if exists t1, t2;
create table t1 (id int primary key, col1 varchar(20), col2 varchar(20), col3 varchar(20),col4 varchar(20),col5 varchar(20),col6 varchar(20));

create table t2 (id int primary key, col1 varchar(20), col2 varchar(20), col3 varchar(20),col4 varchar(20),col5 varchar(20),col6 varchar(20)) 
    partition by range(id) ( 
        partition p1 values less than (10000), 
        partition p2 values less than(20000), 
        partition p3 values less than MAXVALUE
);

insert into t1 select rownum,lpad(rownum,20,'0'),lpad(rownum % 5,20,'0'),lpad(rownum,20,'0'),lpad(rownum,20,'0'),lpad(rownum,20,'0'),lpad(rownum,20,'0') 
from db_class a, db_class b, db_class c, db_class d, db_class e, db_class f limit 500000;
insert into t2 select rownum,lpad(rownum,20,'0'),lpad(rownum % 5,20,'0'),lpad(rownum,20,'0'),lpad(rownum,20,'0'),lpad(rownum,20,'0'),lpad(rownum,20,'0') 
from db_class a, db_class b, db_class c, db_class d, db_class e, db_class f limit 100000;

with cte as (
 select /*+ parallel(16) ordered materialize */ a.col1, b.id from t1 a, t2 b 
    where cast(a.col1 as int)/5 = b.id and b.id < 10000
) select /*+ recompile */ 1 from cte limit 1;

기존 row by row 방식:

Trace Statistics:
  SELECT (time: 17480, fetch: 6041553, fetch_time: 11034, ioread: 0)
    SCAN (temp time: 0, fetch: 0, ioread: 0, readrows: 1, rows: 1)
    SUBQUERY (uncorrelated)
      CTE (non_recursive_part)
        SELECT (time: 17480, fetch: 6041553, fetch_time: 11034, ioread: 0)
          SCAN (table: dba.t1), (heap time: 424, fetch: 2040052, ioread: 0, readrows: 500000, rows: 500000)
               (parallel workers: 16, heap time: 470..473, readrows: 24563..33957, rows: 24563..33957, gather: row by row)
            SCAN (index: dba.t2.pk_t2_id), (btree time: 16473, fetch: 4000000, ioread: 0, readkeys: 49999, filteredkeys: 49995, rows: 49995, covered: tr
ue)
                   PARTITION (index: dba.t2__p__p1.pk_t2_id), (btree time: 16473, fetch: 4000000, ioread: 0, readkeys: 49999, filteredkeys: 49995, rows:
 49995, covered: true)
            MEMOIZE (time: 127, hit: 0, miss: 1001, size: 261KB, enabled: false)

mergeable list 방식:

Trace Statistics:
  SELECT (time: 1574, fetch: 6027596, fetch_time: 9336, ioread: 0)
    SCAN (temp time: 0, fetch: 4, ioread: 0, readrows: 1, rows: 1)
    SUBQUERY (uncorrelated)
      CTE (non_recursive_part)
        SELECT (time: 1574, fetch: 6027592, fetch_time: 9336, ioread: 0)
          SCAN (table: dba.t1), (heap time: 1573, fetch: 6027576, ioread: 0, readrows: 500000, rows: 500000)
               (parallel workers: 16, heap time: 1567..1571, readrows: 29876..32801, rows: 29876..32801, gather: mergeable 
list)
            SCAN (index: dba.t2.pk_t2_id), (btree time: 1077, fetch: 4000000, ioread: 0, readkeys: 49999, filteredkeys: 499
95, rows: 49995, covered: true)
            MEMOIZE (time: 0, hit: 0, miss: 16016, size: 3999KB, enabled: false)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

b651847 에서 정상동작하게 수정했습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants