Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CBRD-25382] Added a sql test case for Support HASH JOIN with hint required #1936

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
504 changes: 504 additions & 0 deletions sql/_35_fig_cake/cbrd_25382/answers/cbrd_25382_1.answer

Large diffs are not rendered by default.

1,057 changes: 1,057 additions & 0 deletions sql/_35_fig_cake/cbrd_25382/answers/cbrd_25382_2.answer

Large diffs are not rendered by default.

481 changes: 481 additions & 0 deletions sql/_35_fig_cake/cbrd_25382/answers/cbrd_25382_3.answer

Large diffs are not rendered by default.

604 changes: 604 additions & 0 deletions sql/_35_fig_cake/cbrd_25382/answers/cbrd_25382_4.answer

Large diffs are not rendered by default.

686 changes: 686 additions & 0 deletions sql/_35_fig_cake/cbrd_25382/answers/cbrd_25382_5.answer

Large diffs are not rendered by default.

720 changes: 720 additions & 0 deletions sql/_35_fig_cake/cbrd_25382/answers/cbrd_25382_6.answer

Large diffs are not rendered by default.

324 changes: 324 additions & 0 deletions sql/_35_fig_cake/cbrd_25382/answers/cbrd_25382_7.answer
Original file line number Diff line number Diff line change
@@ -0,0 +1,324 @@
===================================================
0
===================================================
0
===================================================
0
===================================================
4
===================================================
0
===================================================
0
===================================================
0
===================================================
0
===================================================

#### 1. hint: recompile use_hash

===================================================
a_ca b_ca c_ca
1 1 1
2 2 2
3 3 3
4 4 4

Query plan:
hash-join (inner join)
edge: term[?]
outer: hash-join (inner join)
edge: term[?]
outer: sscan
class: ab node[?]
sargs: term[?]
cost: ? card ?
inner: sscan
class: b node[?]
sargs: term[?]
cost: ? card ?
cost: ? card ?
inner: sscan
class: c node[?]
sargs: term[?]
cost: ? card ?
cost: ? card ?
Query stmt:
select /*+ USE_HASH */ ab.ca, b.ca, c.ca from ta ab, tb b, tc c where (b.ca=c.ca) and (ab.ca=b.ca) and b.flag= ?:? and ab.flag= ?:? and c.flag= ?:?
===================================================
0
===================================================

#### 2. hint: recompile + use_hash

===================================================
a_ca b_ca c_ca
1 1 1
2 2 2
3 3 3
4 4 4

Query plan:
hash-join (inner join)
edge: term[?]
outer: hash-join (inner join)
edge: term[?]
outer: sscan
class: ab node[?]
sargs: term[?]
cost: ? card ?
inner: sscan
class: b node[?]
sargs: term[?]
cost: ? card ?
cost: ? card ?
inner: sscan
class: c node[?]
sargs: term[?]
cost: ? card ?
cost: ? card ?
Query stmt:
select /*+ USE_HASH */ ab.ca, b.ca, c.ca from ta ab, tb b, tc c where (b.ca=c.ca) and (ab.ca=b.ca) and b.flag= ?:? and ab.flag= ?:? and c.flag= ?:?
===================================================
0
===================================================

#### 3. hint: recompile use_hash + use_hash

===================================================
a_ca b_ca c_ca
1 1 1
2 2 2
3 3 3
4 4 4

Query plan:
hash-join (inner join)
edge: term[?]
outer: hash-join (inner join)
edge: term[?]
outer: sscan
class: ab node[?]
sargs: term[?]
cost: ? card ?
inner: sscan
class: b node[?]
sargs: term[?]
cost: ? card ?
cost: ? card ?
inner: sscan
class: c node[?]
sargs: term[?]
cost: ? card ?
cost: ? card ?
Query stmt:
select /*+ USE_HASH */ ab.ca, b.ca, c.ca from ta ab, tb b, tc c where (b.ca=c.ca) and (ab.ca=b.ca) and b.flag= ?:? and ab.flag= ?:? and c.flag= ?:?
===================================================
0
===================================================

#### 4. hint: recompile no_use_hash + use_hash

===================================================
a_ca b_ca c_ca
1 1 1
2 2 2
3 3 3
4 4 4

Query plan:
nl-join (inner join)
edge: term[?]
outer: nl-join (inner join)
edge: term[?]
outer: sscan
class: ab node[?]
sargs: term[?]
cost: ? card ?
inner: sscan
class: b node[?]
sargs: term[?] AND term[?]
cost: ? card ?
cost: ? card ?
inner: sscan
class: c node[?]
sargs: term[?] AND term[?]
cost: ? card ?
cost: ? card ?
Query stmt:
select /*+ NO_USE_HASH USE_HASH */ ab.ca, b.ca, c.ca from ta ab, tb b, tc c where (b.ca=c.ca) and (ab.ca=b.ca) and b.flag= ?:? and ab.flag= ?:? and c.flag= ?:?
===================================================
0
===================================================

#### 5. hint: recompile use_hash(ab,c) + use_hash(a,b)

===================================================
a_ca b_ca c_ca
1 1 1
2 2 2
3 3 3
4 4 4

Query plan:
hash-join (inner join)
edge: term[?]
outer: hash-join (inner join)
edge: term[?]
outer: sscan
class: ab node[?]
sargs: term[?]
cost: ? card ?
inner: sscan
class: b node[?]
sargs: term[?]
cost: ? card ?
cost: ? card ?
inner: sscan
class: c node[?]
sargs: term[?]
cost: ? card ?
cost: ? card ?
Query stmt:
select /*+ USE_HASH(ab, c, a, b) */ ab.ca, b.ca, c.ca from ta ab, tb b, tc c where (b.ca=c.ca) and (ab.ca=b.ca) and b.flag= ?:? and ab.flag= ?:? and c.flag= ?:?
===================================================
0
===================================================

#### 6. hint: recompile use_hash(ab) + no_use_hash(a)

===================================================
a_ca b_ca c_ca
1 1 1
2 2 2
3 3 3
4 4 4

Query plan:
nl-join (inner join)
edge: term[?]
outer: nl-join (inner join)
edge: term[?]
outer: sscan
class: ab node[?]
sargs: term[?]
cost: ? card ?
inner: sscan
class: b node[?]
sargs: term[?] AND term[?]
cost: ? card ?
cost: ? card ?
inner: sscan
class: c node[?]
sargs: term[?] AND term[?]
cost: ? card ?
cost: ? card ?
Query stmt:
select /*+ NO_USE_HASH(a) USE_HASH(ab) */ ab.ca, b.ca, c.ca from ta ab, tb b, tc c where (b.ca=c.ca) and (ab.ca=b.ca) and b.flag= ?:? and ab.flag= ?:? and c.flag= ?:?
===================================================
0
===================================================

#### 7. hint: recompile no_use_hash(ab) + use_hash(a)

===================================================
a_ca b_ca c_ca
1 1 1
2 2 2
3 3 3
4 4 4

Query plan:
nl-join (inner join)
edge: term[?]
outer: hash-join (inner join)
youngjinj marked this conversation as resolved.
Show resolved Hide resolved
edge: term[?]
outer: sscan
class: b node[?]
sargs: term[?]
cost: ? card ?
inner: sscan
class: ab node[?]
sargs: term[?]
cost: ? card ?
cost: ? card ?
inner: sscan
class: c node[?]
sargs: term[?] AND term[?]
cost: ? card ?
cost: ? card ?
Query stmt:
select /*+ NO_USE_HASH(ab) USE_HASH(a) */ ab.ca, b.ca, c.ca from ta ab, tb b, tc c where (b.ca=c.ca) and (ab.ca=b.ca) and b.flag= ?:? and ab.flag= ?:? and c.flag= ?:?
===================================================
0
===================================================

#### 8. hint: recompile no_use_hash(a,b,c) + use_hash(a,b,c)

===================================================
a_ca b_ca c_ca
1 1 1
2 2 2
3 3 3
4 4 4

Query plan:
hash-join (inner join)
edge: term[?]
outer: hash-join (inner join)
edge: term[?]
outer: sscan
class: c node[?]
sargs: term[?]
cost: ? card ?
inner: sscan
class: b node[?]
sargs: term[?]
cost: ? card ?
cost: ? card ?
inner: sscan
class: ab node[?]
sargs: term[?]
cost: ? card ?
cost: ? card ?
Query stmt:
select /*+ NO_USE_HASH(c) USE_HASH(a, b) */ ab.ca, b.ca, c.ca from ta ab, tb b, tc c where (b.ca=c.ca) and (ab.ca=b.ca) and b.flag= ?:? and ab.flag= ?:? and c.flag= ?:?
===================================================
0
===================================================

#### 9. hint: recompile use_hash(a,b,c) + no_use_hash(a,b,c)

===================================================
a_ca b_ca c_ca
1 1 1
2 2 2
3 3 3
4 4 4

Query plan:
hash-join (inner join)
edge: term[?]
outer: nl-join (inner join)
edge: term[?]
outer: sscan
class: ab node[?]
sargs: term[?]
cost: ? card ?
inner: sscan
class: b node[?]
sargs: term[?] AND term[?]
cost: ? card ?
cost: ? card ?
inner: sscan
class: c node[?]
sargs: term[?]
cost: ? card ?
cost: ? card ?
Query stmt:
select /*+ NO_USE_HASH(a, b) USE_HASH(c) */ ab.ca, b.ca, c.ca from ta ab, tb b, tc c where (b.ca=c.ca) and (ab.ca=b.ca) and b.flag= ?:? and ab.flag= ?:? and c.flag= ?:?
===================================================
0
===================================================
0
Loading