SlideShare ist ein Scribd-Unternehmen logo
1 von 20
PRESENTATION ON :
SEMIJOIN – IT’S EFFECTIVENESS
IN DISTRIBUTED ENVIRONMENT
PRESENTED BY –
Alokeparna Choudhury,
UNIVERSITY INSTITUTE OF TECHNOLOGY
(THE UNIVERSITY OF BURDWAN)
ROLL NO.: ME201310005
REGISTRATION NO.: 2783 of 2009-10
Contents
1. Distributed system
2. Relational algebra
3. Join
4. Semi-join
5. Simple semi-join example
6. How oracle evaluates EXISTS and IN
7. Examples
8. Effectiveness
9. References
What is distributed database system?
 A distributed database system is characterized by
the distribution of the system components of
hardware ,control and data.
 A distributed system is a collection of independent
computers interconnected via point-to-point
communication lines.
 what is distributed query processing?
The retrieval of data from different sites in a network is
known as distributed query processing.
Relational Algebra
 The Relational Algebra is used to define the
ways in which relations (tables) can be operated
to manipulate their data.
 This Algebra is composed of Unary operations
(involving a single table) and Binary operations
(involving multiple tables).
 Join, Semi-join these are Binary operations in
Relational Algebra.
Join
 Join is a binary operation in Relational Algebra.
 It combines records from two or more tables in a
database.
 A join is a means for combining fields from two
tables by using values common to each.
Semi-Join
•A Join where the result only contains the columns
from one of the joined tables.
•Useful in distributed databases, so we don't have to
send as much data over the network.
•Can dramatically speed up certain classes of
queries.
What is “Semi-Join” ?
Semi-join strategies are technique for query processing in
distributed database systems.
Used for reducing communication cost.
A semi-join between two tables returns rows from the first
table where one or more matches are found in the second
table.
The difference between a semi-join and a conventional
join is that rows in the first table will be returned at most
once. Even if the second table contains two matches for a
row in the first table, only one copy of the row will be
returned.
Semi-joins are written using EXISTS or IN.
A Simple Semi-Join Example
“Give a list of departments with at least one employee.”
Query written with a conventional join:
SELECT D.deptno, D.dname
FROM dept D, emp E
WHERE E.deptno = D.deptno
ORDER BY D.deptno;
◦ A department with N employees will appear in the list
N times.
◦ We could use a DISTINCT keyword to get each
department to appear only once.
A Simple Semi-Join Example
“Give a list of departments with at least one employee.”
Query written with a semi-join:
SELECT D.deptno, D.dname
FROM dept D
WHERE EXISTS
(SELECT 1
FROM emp E
WHERE E.deptno = D.deptno)
ORDER BY D.deptno;
◦ No department appears more than once.
◦ Oracle stops processing each department as soon
as the first employee in that department is found.
How Oracle Evaluates EXISTS
and IN
 Oracle transforms the sub query into a join if at all
possible.
 Oracle does not consider cost when deciding whether or
not to do this transformation.
 Oracle can perform a semi-join in a few different ways:
◦ Semi-join access path.
◦ Conventional join access path followed by a sort to remove
duplicate rows.
◦ Scan of first table with a filter operation against the second
table.
How Oracle Evaluates EXISTS
and IN
 Rule of thumb from the Oracle 8i/9i/10g
Performance Tuning Guide (highly simplified):
◦ Use EXISTS when outer query is selective.
◦ Use IN when sub-query is selective and outer
query is not.
◦ Rule of thumb is valid for Oracle 8i.
◦ Oracle 9i often does the right thing regardless of
whether EXISTS or IN is used.
Semi-Join Example #1
Query: A class list of each course is to be prepared.
At Site1: STUDENT(std_id, std_name)
At Site2: REGISTRATION(std_id, course_id)
Steps of Semi-join:
1. Project REGISTRATION on std_id.
X=∏std_id(REGISTRATION)
2. Transmit X to Site1.
3. At Site1, select those topples of STUDENT that have the
same value for std_id as a topple in
∏std_id(REGISTRATION) by a Join.
Y= STUDENT REGISTRATION = STUDENT X
Semi-Join Example #1
(After the previous 3 steps we get only registered students)
4. Send Y to Site2 and then Join with REGISTRATION.
Now we get the complete final result i.e. the class list
of all students on a particular course.
Semi-Join Example #2
Query: “List the gold-status customers who have
placed an order within the last three days.”
SELECT DISTINCT C.short_name, C.customer_id
FROM customers C, orders O
WHERE C.customer_type = 'Gold'
AND O.customer_id = C.customer_id
AND O.order_date > SYSDATE - 3
ORDER BY C.short_name;
Semi-Join Example #2
What we see on the previous slide:
◦ The query was written with a conventional join
and DISTINCT instead of an EXISTS or IN
clause.
◦ Oracle performed a conventional join followed by
a sort for uniqueness in order to remove the
duplicates. (18 of the 20 rows resulting from the
join were apparently duplicates.)
◦ The query took 6.70 seconds to complete and
performed 33,608 logical reads.
Semi-Join Example #2
 Rewritten with a semi-join:
SELECT C.short_name, C.customer_id
FROM customers C
WHERE C.customer_type = 'Gold'
AND EXISTS
(
SELECT 1
FROM orders O
WHERE O.customer_id = C.customer_id
AND O.order_date > SYSDATE - 3
)
ORDER BY C.short_name;
Semi-Join Example #2
What we see on the previous slide:
◦ An EXISTS clause was used to specify a semi-
join.
◦ Oracle performed a semi-join instead of a
conventional join. This offers two benefits:
 Oracle can move on to the next customer
record as soon as the first matching order
record is found.
 There is no need to sort out duplicate records.
◦ The query took 6.42 seconds to complete and
performed 33,608 logical reads.
Effectiveness of Semi-join
 The semi-join is the special way of joining data from multiple tables
in a query.
 We use EXISTS, IN clauses to denote this special type of Join.
 Oracle has special access paths that can make semi-joins extremely
efficient.
 Understanding how semi-join works—and how Oracle implements
the relevant data access paths—will enable us to write very efficient
SQL and dramatically speed up an entire class of queries.
 Semi-join does not give the final result still it is efficient in reducing
communication cost than conventional Join.
References
1. Using 2-way semijoin in distributed query processing.
By Hyunchul Kang and Nick Roussopoulos.
2. Improving distributed query processing by hash-
semijoins. By Judy Tseng and Arbee Chen.
3. Domain Specific Semijoin:A new operation for
distributed query processing. By Jason Chen and
Victor Li.
4. Composite Semijoin in distributed query processing.
By William Perrizio and Chun Chen
Semi join

Weitere ähnliche Inhalte

Was ist angesagt?

Distributed Database Management System
Distributed Database Management SystemDistributed Database Management System
Distributed Database Management SystemAAKANKSHA JAIN
 
Distributed Query Processing
Distributed Query ProcessingDistributed Query Processing
Distributed Query ProcessingMythili Kannan
 
Query processing and optimization (updated)
Query processing and optimization (updated)Query processing and optimization (updated)
Query processing and optimization (updated)Ravinder Kamboj
 
Join ordering in fragment queries
Join ordering in fragment queriesJoin ordering in fragment queries
Join ordering in fragment queriesIfzalhussainkhan
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Meghaj Mallick
 
database recovery techniques
database recovery techniques database recovery techniques
database recovery techniques Kalhan Liyanage
 
Fragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed DatabaseFragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed DatabaseAbhilasha Lahigude
 
8 query processing and optimization
8 query processing and optimization8 query processing and optimization
8 query processing and optimizationKumar
 
6. Integrity and Security in DBMS
6. Integrity and Security in DBMS6. Integrity and Security in DBMS
6. Integrity and Security in DBMSkoolkampus
 
Challenges of Conventional Systems.pptx
Challenges of Conventional Systems.pptxChallenges of Conventional Systems.pptx
Challenges of Conventional Systems.pptxGovardhanV7
 
Flow oriented modeling
Flow oriented modelingFlow oriented modeling
Flow oriented modelingramyaaswin
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-SystemsVenkata Sreeram
 
Homogeneous ddbms
Homogeneous ddbmsHomogeneous ddbms
Homogeneous ddbmsPooja Dixit
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLEVraj Patel
 
object oriented methodologies
object oriented methodologiesobject oriented methodologies
object oriented methodologiesAmith Tiwari
 

Was ist angesagt? (20)

Acid properties
Acid propertiesAcid properties
Acid properties
 
Distributed Database Management System
Distributed Database Management SystemDistributed Database Management System
Distributed Database Management System
 
Distributed Query Processing
Distributed Query ProcessingDistributed Query Processing
Distributed Query Processing
 
Query processing and optimization (updated)
Query processing and optimization (updated)Query processing and optimization (updated)
Query processing and optimization (updated)
 
Join ordering in fragment queries
Join ordering in fragment queriesJoin ordering in fragment queries
Join ordering in fragment queries
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.
 
database recovery techniques
database recovery techniques database recovery techniques
database recovery techniques
 
Fragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed DatabaseFragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed Database
 
8 query processing and optimization
8 query processing and optimization8 query processing and optimization
8 query processing and optimization
 
Deadlock dbms
Deadlock dbmsDeadlock dbms
Deadlock dbms
 
Database System Architectures
Database System ArchitecturesDatabase System Architectures
Database System Architectures
 
6. Integrity and Security in DBMS
6. Integrity and Security in DBMS6. Integrity and Security in DBMS
6. Integrity and Security in DBMS
 
Challenges of Conventional Systems.pptx
Challenges of Conventional Systems.pptxChallenges of Conventional Systems.pptx
Challenges of Conventional Systems.pptx
 
Flow oriented modeling
Flow oriented modelingFlow oriented modeling
Flow oriented modeling
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
 
Homogeneous ddbms
Homogeneous ddbmsHomogeneous ddbms
Homogeneous ddbms
 
Uml class-diagram
Uml class-diagramUml class-diagram
Uml class-diagram
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
object oriented methodologies
object oriented methodologiesobject oriented methodologies
object oriented methodologies
 

Ähnlich wie Semi join

Speeding up queries with semi joins and anti-joins
Speeding up queries with semi joins and anti-joinsSpeeding up queries with semi joins and anti-joins
Speeding up queries with semi joins and anti-joinsKaing Menglieng
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfkarymadelaneyrenne19
 
Sql scripting sorcerypaper
Sql scripting sorcerypaperSql scripting sorcerypaper
Sql scripting sorcerypaperoracle documents
 
Sql interview-book
Sql interview-bookSql interview-book
Sql interview-bookVipul Wankar
 
Sql interview-book
Sql interview-bookSql interview-book
Sql interview-bookVipul Wankar
 
PPT of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
PPT  of Common Table Expression (CTE), Window Functions, JOINS, SubQueryPPT  of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
PPT of Common Table Expression (CTE), Window Functions, JOINS, SubQueryAbhishek590097
 
Bank Question Solution-ADBA Previous Year Question for AP, ANE, AME, ADA, AE
Bank Question Solution-ADBA Previous Year Question for AP, ANE, AME, ADA, AEBank Question Solution-ADBA Previous Year Question for AP, ANE, AME, ADA, AE
Bank Question Solution-ADBA Previous Year Question for AP, ANE, AME, ADA, AEEngr. Md. Jamal Uddin Rayhan
 
3963066 pl-sql-notes-only
3963066 pl-sql-notes-only3963066 pl-sql-notes-only
3963066 pl-sql-notes-onlyAshwin Kumar
 
Dbms narrative question answers
Dbms narrative question answersDbms narrative question answers
Dbms narrative question answersshakhawat02
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007paulguerin
 
Sql interview question part 12
Sql interview question part 12Sql interview question part 12
Sql interview question part 12kaashiv1
 
Sql interview question part 12
Sql interview question part 12Sql interview question part 12
Sql interview question part 12kaashiv1
 
SQL dabatase interveiw pdf for interveiw preparation
SQL dabatase  interveiw pdf for interveiw preparationSQL dabatase  interveiw pdf for interveiw preparation
SQL dabatase interveiw pdf for interveiw preparationkumarvikesh2841998
 
Performance tuning
Performance tuningPerformance tuning
Performance tuningami111
 

Ähnlich wie Semi join (20)

Speeding up queries with semi joins and anti-joins
Speeding up queries with semi joins and anti-joinsSpeeding up queries with semi joins and anti-joins
Speeding up queries with semi joins and anti-joins
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
 
Sql scripting sorcerypaper
Sql scripting sorcerypaperSql scripting sorcerypaper
Sql scripting sorcerypaper
 
Sql interview-book
Sql interview-bookSql interview-book
Sql interview-book
 
Sql interview-book
Sql interview-bookSql interview-book
Sql interview-book
 
PPT of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
PPT  of Common Table Expression (CTE), Window Functions, JOINS, SubQueryPPT  of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
PPT of Common Table Expression (CTE), Window Functions, JOINS, SubQuery
 
ADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASADADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASAD
 
Database testing
Database testingDatabase testing
Database testing
 
SQL Tunning
SQL TunningSQL Tunning
SQL Tunning
 
Bank Question Solution-ADBA Previous Year Question for AP, ANE, AME, ADA, AE
Bank Question Solution-ADBA Previous Year Question for AP, ANE, AME, ADA, AEBank Question Solution-ADBA Previous Year Question for AP, ANE, AME, ADA, AE
Bank Question Solution-ADBA Previous Year Question for AP, ANE, AME, ADA, AE
 
3963066 pl-sql-notes-only
3963066 pl-sql-notes-only3963066 pl-sql-notes-only
3963066 pl-sql-notes-only
 
Interview Questions.pdf
Interview Questions.pdfInterview Questions.pdf
Interview Questions.pdf
 
Dbms narrative question answers
Dbms narrative question answersDbms narrative question answers
Dbms narrative question answers
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007
 
Sql interview question part 12
Sql interview question part 12Sql interview question part 12
Sql interview question part 12
 
Ebook12
Ebook12Ebook12
Ebook12
 
Sql interview question part 12
Sql interview question part 12Sql interview question part 12
Sql interview question part 12
 
SQL dabatase interveiw pdf for interveiw preparation
SQL dabatase  interveiw pdf for interveiw preparationSQL dabatase  interveiw pdf for interveiw preparation
SQL dabatase interveiw pdf for interveiw preparation
 
Oracle notes
Oracle notesOracle notes
Oracle notes
 
Performance tuning
Performance tuningPerformance tuning
Performance tuning
 

Kürzlich hochgeladen

Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksMagic Marks
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesRAJNEESHKUMAR341697
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxnuruddin69
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...soginsider
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadhamedmustafa094
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
Rums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfRums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfsmsksolar
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...Health
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 

Kürzlich hochgeladen (20)

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Rums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfRums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdf
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 

Semi join

  • 1. PRESENTATION ON : SEMIJOIN – IT’S EFFECTIVENESS IN DISTRIBUTED ENVIRONMENT PRESENTED BY – Alokeparna Choudhury, UNIVERSITY INSTITUTE OF TECHNOLOGY (THE UNIVERSITY OF BURDWAN) ROLL NO.: ME201310005 REGISTRATION NO.: 2783 of 2009-10
  • 2. Contents 1. Distributed system 2. Relational algebra 3. Join 4. Semi-join 5. Simple semi-join example 6. How oracle evaluates EXISTS and IN 7. Examples 8. Effectiveness 9. References
  • 3. What is distributed database system?  A distributed database system is characterized by the distribution of the system components of hardware ,control and data.  A distributed system is a collection of independent computers interconnected via point-to-point communication lines.  what is distributed query processing? The retrieval of data from different sites in a network is known as distributed query processing.
  • 4. Relational Algebra  The Relational Algebra is used to define the ways in which relations (tables) can be operated to manipulate their data.  This Algebra is composed of Unary operations (involving a single table) and Binary operations (involving multiple tables).  Join, Semi-join these are Binary operations in Relational Algebra.
  • 5. Join  Join is a binary operation in Relational Algebra.  It combines records from two or more tables in a database.  A join is a means for combining fields from two tables by using values common to each.
  • 6. Semi-Join •A Join where the result only contains the columns from one of the joined tables. •Useful in distributed databases, so we don't have to send as much data over the network. •Can dramatically speed up certain classes of queries.
  • 7. What is “Semi-Join” ? Semi-join strategies are technique for query processing in distributed database systems. Used for reducing communication cost. A semi-join between two tables returns rows from the first table where one or more matches are found in the second table. The difference between a semi-join and a conventional join is that rows in the first table will be returned at most once. Even if the second table contains two matches for a row in the first table, only one copy of the row will be returned. Semi-joins are written using EXISTS or IN.
  • 8. A Simple Semi-Join Example “Give a list of departments with at least one employee.” Query written with a conventional join: SELECT D.deptno, D.dname FROM dept D, emp E WHERE E.deptno = D.deptno ORDER BY D.deptno; ◦ A department with N employees will appear in the list N times. ◦ We could use a DISTINCT keyword to get each department to appear only once.
  • 9. A Simple Semi-Join Example “Give a list of departments with at least one employee.” Query written with a semi-join: SELECT D.deptno, D.dname FROM dept D WHERE EXISTS (SELECT 1 FROM emp E WHERE E.deptno = D.deptno) ORDER BY D.deptno; ◦ No department appears more than once. ◦ Oracle stops processing each department as soon as the first employee in that department is found.
  • 10. How Oracle Evaluates EXISTS and IN  Oracle transforms the sub query into a join if at all possible.  Oracle does not consider cost when deciding whether or not to do this transformation.  Oracle can perform a semi-join in a few different ways: ◦ Semi-join access path. ◦ Conventional join access path followed by a sort to remove duplicate rows. ◦ Scan of first table with a filter operation against the second table.
  • 11. How Oracle Evaluates EXISTS and IN  Rule of thumb from the Oracle 8i/9i/10g Performance Tuning Guide (highly simplified): ◦ Use EXISTS when outer query is selective. ◦ Use IN when sub-query is selective and outer query is not. ◦ Rule of thumb is valid for Oracle 8i. ◦ Oracle 9i often does the right thing regardless of whether EXISTS or IN is used.
  • 12. Semi-Join Example #1 Query: A class list of each course is to be prepared. At Site1: STUDENT(std_id, std_name) At Site2: REGISTRATION(std_id, course_id) Steps of Semi-join: 1. Project REGISTRATION on std_id. X=∏std_id(REGISTRATION) 2. Transmit X to Site1. 3. At Site1, select those topples of STUDENT that have the same value for std_id as a topple in ∏std_id(REGISTRATION) by a Join. Y= STUDENT REGISTRATION = STUDENT X
  • 13. Semi-Join Example #1 (After the previous 3 steps we get only registered students) 4. Send Y to Site2 and then Join with REGISTRATION. Now we get the complete final result i.e. the class list of all students on a particular course.
  • 14. Semi-Join Example #2 Query: “List the gold-status customers who have placed an order within the last three days.” SELECT DISTINCT C.short_name, C.customer_id FROM customers C, orders O WHERE C.customer_type = 'Gold' AND O.customer_id = C.customer_id AND O.order_date > SYSDATE - 3 ORDER BY C.short_name;
  • 15. Semi-Join Example #2 What we see on the previous slide: ◦ The query was written with a conventional join and DISTINCT instead of an EXISTS or IN clause. ◦ Oracle performed a conventional join followed by a sort for uniqueness in order to remove the duplicates. (18 of the 20 rows resulting from the join were apparently duplicates.) ◦ The query took 6.70 seconds to complete and performed 33,608 logical reads.
  • 16. Semi-Join Example #2  Rewritten with a semi-join: SELECT C.short_name, C.customer_id FROM customers C WHERE C.customer_type = 'Gold' AND EXISTS ( SELECT 1 FROM orders O WHERE O.customer_id = C.customer_id AND O.order_date > SYSDATE - 3 ) ORDER BY C.short_name;
  • 17. Semi-Join Example #2 What we see on the previous slide: ◦ An EXISTS clause was used to specify a semi- join. ◦ Oracle performed a semi-join instead of a conventional join. This offers two benefits:  Oracle can move on to the next customer record as soon as the first matching order record is found.  There is no need to sort out duplicate records. ◦ The query took 6.42 seconds to complete and performed 33,608 logical reads.
  • 18. Effectiveness of Semi-join  The semi-join is the special way of joining data from multiple tables in a query.  We use EXISTS, IN clauses to denote this special type of Join.  Oracle has special access paths that can make semi-joins extremely efficient.  Understanding how semi-join works—and how Oracle implements the relevant data access paths—will enable us to write very efficient SQL and dramatically speed up an entire class of queries.  Semi-join does not give the final result still it is efficient in reducing communication cost than conventional Join.
  • 19. References 1. Using 2-way semijoin in distributed query processing. By Hyunchul Kang and Nick Roussopoulos. 2. Improving distributed query processing by hash- semijoins. By Judy Tseng and Arbee Chen. 3. Domain Specific Semijoin:A new operation for distributed query processing. By Jason Chen and Victor Li. 4. Composite Semijoin in distributed query processing. By William Perrizio and Chun Chen