Beruflich Dokumente
Kultur Dokumente
Join Methods
Product Join
Definition
Join Process
Stage Process
1
Illustration
Example 1
SELECT Hours, EmpNo, Description
FROM Charges, Project
WHERE Charges.Proj_Id = ENG-0003
AND Project.Proj_Id = ENG-0003
AND Charges.WkEnd > Project.DueDate ;
Example 1
Disadvantages
Example 2
Example 2
SELECT *
FROM Employee, Department
WHERE Employee.Dept > Department.Dept;
Example 2
Notes
Merge Join
Definition
Slow path
Fast path
Slow Path
Stage Process
1
Fast Path
Advantages
Example 1
Example 1
SELECT *
FROM Employee, Department
WHERE Employee.Dept = Department.Dept;
Redistribution
Duplication
Example 2
Matching Indexes
Hash Join
Introduction
Types
Classic
Direct table
Illustration
Illustration
Notes
Summary
Product Join
Merge Join
Adv/disadv
Adv
Types
Strategies
Hash Join
Types
Adv
Nested Join
Definition
Join Process
Stage Process
1
Definition
Join Process
IF the
equality
condition
is on this
index type
USI
1.
2.
3.
4.
Join Process
IF the
THEN the left table is
equality
condition is
on this
index type
NUSI
1.
2.
3.
4.
Join Process
Stage Process
1
Join Process
Stage Process
5
Join Process
Step 1
Left
Table
Right Table
Index
Join Process
Step 2
Right
Table
Join Process
Step 3
Left
Table
Right Table
Index
Right
Table
Example
Employee
Enu
m
Name
Department
Dept
Dept
PK
FK
UPI
Name
PK
UPI
Brown
200
400
Educatio
n
Smith
310
Jones
310
150
Payroll
Clay
400
200
Finance
Peters
150
310
Mfg
Foster
400
Example
SELECT DeptName, Name, YrsExp
FROM Employee, Department
WHERE
Employee.EmpNo =
Department.MgrNo
AND Department.DeptNo = 100
Join Process
Stag Process
e
1
Read a row from the left base table and record its
hash value
Read the next row from the right NUSI subtable that
has
a row
that of the left base table row.
IF the
rowhash
hash>= to THEN
values are
Equal
Not equal
Example
SELECT *
FROM table_1, table_2
WHERE table_1.x_1 = 10
AND table_1.y1 = table_2.NUSI
Definition
Join Process
Stage
Process
Join Process
Rows
Message
Left Table
Right Table
AMP1
AMP2
Join Process
Stage Process
1
Examples
SELECT *
FROM table_1, table_2
WHERE table_1.USI_1
AND table_2.USI_2 = 1
Examples
A remote nested join can be used when
there is no equality condition between
the primary indexes of the two tables
and other conditions
(table_1.UPI = constant
OR table_1.USI = constant)
AND (table_2.UPI = constant
OR table_2.USI = constant)
Advantages
RowID Join
Definition
Join Process
Stage Process
1
Example
SELECT *
FROM table_1, table_2
WHERE
table_1.NUPI = value
AND
table_1.column =
table_2.weakly_selective_NUSI
Example
table_1.column_1 NUPI
table_2.column_3, table_2.column_5 - NUSI
SELECT *
FROM table_1, table_2
WHERE
table_1.column_1 = 10
AND
table_1.column_3 = table_2.column_5
Questions
Thank You