SlideShare a Scribd company logo
1 of 8
Gandhinagar Institute
of Technology(012)
Subject :
Active Learning Assignment
Branch : CE
DIV. : B1
Prepared by : - By:Harsh kothari
Enrolment no.:170120107066
Guided By: Prof. Kiran Shah
Selection Operation
13.2
File scan – search algorithms that locate and retrieve records
that fulfill a selection condition.
Algorithm A1 (linear search). Scan each file block and test all
records to see whether they satisfy the selection condition.
Cost estimate (number of disk blocks scanned) = br
br denotes number of blocks containing records from relation r
If selection is on a key attribute, cost = (br /2)
stop on finding record
Linear search can be applied regardless of
selection condition or
ordering of records in the file, or
availability of indices
Selection Operation (Cont.)
13.3
A2 (binary search). Applicable if selection is an equality
comparison on the attribute on which file is ordered.
Assume that the blocks of a relation are stored contiguously
Cost estimate (number of disk blocks to be scanned):
log2(br) — cost of locating the first tuple by a binary search
on the blocks
Plus number of blocks containing records that satisfy
selection condition
– Will see how to estimate this cost in Chapter 14
Selections Using Indices
13.4
Index scan – search algorithms that use an index
selection condition must be on search-key of index.
A3 (primary index on candidate key, equality). Retrieve a single record
that satisfies the corresponding equality condition
Cost = HTi + 1
A4 (primary index on nonkey, equality) Retrieve multiple records.
Records will be on consecutive blocks
Cost = HTi + number of blocks containing retrieved records
A5 (equality on search-key of secondary index).
Retrieve a single record if the search-key is a candidate key
Cost = HTi + 1
Retrieve multiple records if search-key is not a candidate key
Cost = HTi + number of records retrieved
– Can be very expensive!
each record may be on a different block
– one block access for each retrieved record
Selections Involving Comparisons
13.5
Can implement selections of the form AV (r) or A  V(r) by using
a linear file scan or binary search,
or by using indices in the following ways:
A6 (primary index, comparison). (Relation is sorted on A)
For A  V(r) use index to find first tuple  v and scan relation
sequentially from there
For AV (r) just scan relation sequentially till first tuple > v; do not
use index
A7 (secondary index, comparison).
For A  V(r) use index to find first index entry  v and scan index
sequentially from there, to find pointers to records.
For AV (r) just scan leaf pages of index finding pointers to records,
till first entry > v
In either case, retrieve records that are pointed to
– requires an I/O for each record
– Linear file scan may be cheaper if many records are
to be fetched!
Implementation of Complex Selections
Conjunction: 1 2. . . n(r)
A8 (conjunctive selection using one index).
Select a combination of i and algorithms A1 through A7 that
results in the least cost fori (r).
Test other conditions on tuple after fetching it into memory buffer.
A9 (conjunctive selection using multiple-key index).
Use appropriate composite (multiple-key) index if available.
A10 (conjunctive selection by intersection of identifiers).
Requires indices with record pointers.
Use corresponding index for each condition, and take intersection
of all the obtained sets of record pointers.
Then fetch records from file
If some conditions do not have appropriate indices, apply test in
memory.
Algorithms for Complex Selections
Disjunction:1 2 . . . n (r).
A11 (disjunctive selection by union of identifiers).
Applicable if all conditions have available indices.
Otherwise use linear scan.
Use corresponding index for each condition, and take union of all the
obtained sets of record pointers.
Then fetch records from file
Negation: (r)
Use linear scan on file
If very few records satisfy , and an index is applicable to 
Find satisfying records using index and fetch from file
170120107066 dbms

More Related Content

What's hot

Ml study notes id3
Ml study notes   id3Ml study notes   id3
Ml study notes id3Feri Handoyo
 
Substructure Similarity Search in Graph Databases
Substructure Similarity Search in Graph DatabasesSubstructure Similarity Search in Graph Databases
Substructure Similarity Search in Graph Databasespgst
 
Improved Query Performance With Variant Indexes - review presentation
Improved Query Performance With Variant Indexes - review presentationImproved Query Performance With Variant Indexes - review presentation
Improved Query Performance With Variant Indexes - review presentationVimukthi Wickramasinghe
 
Interval intersection
Interval intersectionInterval intersection
Interval intersectionAabida Noman
 
Анатолий Старостин (ABBYY) "ABBYY InfoExtractor: технология разработки предме...
Анатолий Старостин (ABBYY) "ABBYY InfoExtractor: технология разработки предме...Анатолий Старостин (ABBYY) "ABBYY InfoExtractor: технология разработки предме...
Анатолий Старостин (ABBYY) "ABBYY InfoExtractor: технология разработки предме...AINL Conferences
 
stacks in algorithems and data structure
stacks in algorithems and data structurestacks in algorithems and data structure
stacks in algorithems and data structurefaran nawaz
 
MATRIX HASHING WITH TWO LEVEL OF COLLISION RESOLUTION
MATRIX HASHING WITH TWO LEVEL OF COLLISION RESOLUTIONMATRIX HASHING WITH TWO LEVEL OF COLLISION RESOLUTION
MATRIX HASHING WITH TWO LEVEL OF COLLISION RESOLUTIONNvk Chaitanya
 
Introduction to datastructure and algorithm
Introduction to datastructure and algorithmIntroduction to datastructure and algorithm
Introduction to datastructure and algorithmPratik Mota
 
AjayBhullar_Resume (5)
AjayBhullar_Resume (5)AjayBhullar_Resume (5)
AjayBhullar_Resume (5)Ajay Bhullar
 

What's hot (20)

Ml study notes id3
Ml study notes   id3Ml study notes   id3
Ml study notes id3
 
Application of Stack, Link list , and Queue in Programming .
Application of Stack, Link list , and Queue in Programming .Application of Stack, Link list , and Queue in Programming .
Application of Stack, Link list , and Queue in Programming .
 
Substructure Similarity Search in Graph Databases
Substructure Similarity Search in Graph DatabasesSubstructure Similarity Search in Graph Databases
Substructure Similarity Search in Graph Databases
 
Improved Query Performance With Variant Indexes - review presentation
Improved Query Performance With Variant Indexes - review presentationImproved Query Performance With Variant Indexes - review presentation
Improved Query Performance With Variant Indexes - review presentation
 
Interval intersection
Interval intersectionInterval intersection
Interval intersection
 
Lo18
Lo18Lo18
Lo18
 
Quick sorting
Quick sortingQuick sorting
Quick sorting
 
Анатолий Старостин (ABBYY) "ABBYY InfoExtractor: технология разработки предме...
Анатолий Старостин (ABBYY) "ABBYY InfoExtractor: технология разработки предме...Анатолий Старостин (ABBYY) "ABBYY InfoExtractor: технология разработки предме...
Анатолий Старостин (ABBYY) "ABBYY InfoExtractor: технология разработки предме...
 
stacks in algorithems and data structure
stacks in algorithems and data structurestacks in algorithems and data structure
stacks in algorithems and data structure
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
MATRIX HASHING WITH TWO LEVEL OF COLLISION RESOLUTION
MATRIX HASHING WITH TWO LEVEL OF COLLISION RESOLUTIONMATRIX HASHING WITH TWO LEVEL OF COLLISION RESOLUTION
MATRIX HASHING WITH TWO LEVEL OF COLLISION RESOLUTION
 
Quick sort
Quick sortQuick sort
Quick sort
 
Best,worst,average case .17581556 045
Best,worst,average case .17581556 045Best,worst,average case .17581556 045
Best,worst,average case .17581556 045
 
Vectors,squence & list
Vectors,squence & listVectors,squence & list
Vectors,squence & list
 
Linear search
Linear searchLinear search
Linear search
 
Introduction to datastructure and algorithm
Introduction to datastructure and algorithmIntroduction to datastructure and algorithm
Introduction to datastructure and algorithm
 
Assignment in java
Assignment in javaAssignment in java
Assignment in java
 
Thesis Talk
Thesis TalkThesis Talk
Thesis Talk
 
Functional Concepts
Functional ConceptsFunctional Concepts
Functional Concepts
 
AjayBhullar_Resume (5)
AjayBhullar_Resume (5)AjayBhullar_Resume (5)
AjayBhullar_Resume (5)
 

Similar to 170120107066 dbms

13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMSkoolkampus
 
Query evaluation and optimization
Query evaluation and optimizationQuery evaluation and optimization
Query evaluation and optimizationlavanya marichamy
 
Algorithm ch13.ppt
Algorithm ch13.pptAlgorithm ch13.ppt
Algorithm ch13.pptDreamless2
 
Korth_Query_processing.pptx
Korth_Query_processing.pptxKorth_Query_processing.pptx
Korth_Query_processing.pptxDrSonuMittal
 
Query Processing, Query Optimization and Transaction
Query Processing, Query Optimization and TransactionQuery Processing, Query Optimization and Transaction
Query Processing, Query Optimization and TransactionPrabu U
 
Adbms 38 algorithms for select and join operations
Adbms 38 algorithms for select and join operationsAdbms 38 algorithms for select and join operations
Adbms 38 algorithms for select and join operationsVaibhav Khanna
 
The actual illustration of values is decided by the machine design (.pdf
The actual illustration of values is decided by the machine design (.pdfThe actual illustration of values is decided by the machine design (.pdf
The actual illustration of values is decided by the machine design (.pdfanyacarpets
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductionsirshad17
 
Report on the CLEF-IP 2012 Experiments: Search of Topically Organized Patents
Report on the CLEF-IP 2012 Experiments: Search of Topically Organized PatentsReport on the CLEF-IP 2012 Experiments: Search of Topically Organized Patents
Report on the CLEF-IP 2012 Experiments: Search of Topically Organized PatentsMike Salampasis
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management Systemsweetysweety8
 
best first-sort
best first-sortbest first-sort
best first-sortRajendran
 

Similar to 170120107066 dbms (20)

13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMS
 
28890 lecture10
28890 lecture1028890 lecture10
28890 lecture10
 
Query evaluation and optimization
Query evaluation and optimizationQuery evaluation and optimization
Query evaluation and optimization
 
Ch13
Ch13Ch13
Ch13
 
Algorithm ch13.ppt
Algorithm ch13.pptAlgorithm ch13.ppt
Algorithm ch13.ppt
 
Korth_Query_processing.pptx
Korth_Query_processing.pptxKorth_Query_processing.pptx
Korth_Query_processing.pptx
 
Query processing System
Query processing SystemQuery processing System
Query processing System
 
ch12.ppt
ch12.pptch12.ppt
ch12.ppt
 
Query Processing, Query Optimization and Transaction
Query Processing, Query Optimization and TransactionQuery Processing, Query Optimization and Transaction
Query Processing, Query Optimization and Transaction
 
Lucece Indexing
Lucece IndexingLucece Indexing
Lucece Indexing
 
Lesson11 transactions
Lesson11 transactionsLesson11 transactions
Lesson11 transactions
 
Adbms 38 algorithms for select and join operations
Adbms 38 algorithms for select and join operationsAdbms 38 algorithms for select and join operations
Adbms 38 algorithms for select and join operations
 
The actual illustration of values is decided by the machine design (.pdf
The actual illustration of values is decided by the machine design (.pdfThe actual illustration of values is decided by the machine design (.pdf
The actual illustration of values is decided by the machine design (.pdf
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductions
 
Unit08 dbms
Unit08 dbmsUnit08 dbms
Unit08 dbms
 
grep.1.pdf
grep.1.pdfgrep.1.pdf
grep.1.pdf
 
grep.1.pdf
grep.1.pdfgrep.1.pdf
grep.1.pdf
 
Report on the CLEF-IP 2012 Experiments: Search of Topically Organized Patents
Report on the CLEF-IP 2012 Experiments: Search of Topically Organized PatentsReport on the CLEF-IP 2012 Experiments: Search of Topically Organized Patents
Report on the CLEF-IP 2012 Experiments: Search of Topically Organized Patents
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
best first-sort
best first-sortbest first-sort
best first-sort
 

More from harsh kothari

Instructuion set of 8085
Instructuion set of 8085Instructuion set of 8085
Instructuion set of 8085harsh kothari
 
Fractional Knapsack Problem
Fractional Knapsack ProblemFractional Knapsack Problem
Fractional Knapsack Problemharsh kothari
 
stirling method maths
stirling method mathsstirling method maths
stirling method mathsharsh kothari
 
170120107066 dielectric.ppt
170120107066 dielectric.ppt170120107066 dielectric.ppt
170120107066 dielectric.pptharsh kothari
 
170120107074 looping statements and nesting of loop statements
170120107074 looping statements and nesting of loop statements170120107074 looping statements and nesting of loop statements
170120107074 looping statements and nesting of loop statementsharsh kothari
 
170120107066 chronemics.ppt
170120107066 chronemics.ppt170120107066 chronemics.ppt
170120107066 chronemics.pptharsh kothari
 
170120107066 power series.ppt
170120107066 power series.ppt170120107066 power series.ppt
170120107066 power series.pptharsh kothari
 
170120107066 flowchart.ppt
170120107066 flowchart.ppt170120107066 flowchart.ppt
170120107066 flowchart.pptharsh kothari
 

More from harsh kothari (11)

Instructuion set of 8085
Instructuion set of 8085Instructuion set of 8085
Instructuion set of 8085
 
Java(Polymorphism)
Java(Polymorphism)Java(Polymorphism)
Java(Polymorphism)
 
Fractional Knapsack Problem
Fractional Knapsack ProblemFractional Knapsack Problem
Fractional Knapsack Problem
 
stirling method maths
stirling method mathsstirling method maths
stirling method maths
 
170120107066 dielectric.ppt
170120107066 dielectric.ppt170120107066 dielectric.ppt
170120107066 dielectric.ppt
 
Hk
HkHk
Hk
 
170120107074 looping statements and nesting of loop statements
170120107074 looping statements and nesting of loop statements170120107074 looping statements and nesting of loop statements
170120107074 looping statements and nesting of loop statements
 
170120107066 chronemics.ppt
170120107066 chronemics.ppt170120107066 chronemics.ppt
170120107066 chronemics.ppt
 
170120107066 power series.ppt
170120107066 power series.ppt170120107066 power series.ppt
170120107066 power series.ppt
 
170120107066 flowchart.ppt
170120107066 flowchart.ppt170120107066 flowchart.ppt
170120107066 flowchart.ppt
 
control circuit
 control circuit control circuit
control circuit
 

Recently uploaded

GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 

Recently uploaded (20)

GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 

170120107066 dbms

  • 1. Gandhinagar Institute of Technology(012) Subject : Active Learning Assignment Branch : CE DIV. : B1 Prepared by : - By:Harsh kothari Enrolment no.:170120107066 Guided By: Prof. Kiran Shah
  • 2. Selection Operation 13.2 File scan – search algorithms that locate and retrieve records that fulfill a selection condition. Algorithm A1 (linear search). Scan each file block and test all records to see whether they satisfy the selection condition. Cost estimate (number of disk blocks scanned) = br br denotes number of blocks containing records from relation r If selection is on a key attribute, cost = (br /2) stop on finding record Linear search can be applied regardless of selection condition or ordering of records in the file, or availability of indices
  • 3. Selection Operation (Cont.) 13.3 A2 (binary search). Applicable if selection is an equality comparison on the attribute on which file is ordered. Assume that the blocks of a relation are stored contiguously Cost estimate (number of disk blocks to be scanned): log2(br) — cost of locating the first tuple by a binary search on the blocks Plus number of blocks containing records that satisfy selection condition – Will see how to estimate this cost in Chapter 14
  • 4. Selections Using Indices 13.4 Index scan – search algorithms that use an index selection condition must be on search-key of index. A3 (primary index on candidate key, equality). Retrieve a single record that satisfies the corresponding equality condition Cost = HTi + 1 A4 (primary index on nonkey, equality) Retrieve multiple records. Records will be on consecutive blocks Cost = HTi + number of blocks containing retrieved records A5 (equality on search-key of secondary index). Retrieve a single record if the search-key is a candidate key Cost = HTi + 1 Retrieve multiple records if search-key is not a candidate key Cost = HTi + number of records retrieved – Can be very expensive! each record may be on a different block – one block access for each retrieved record
  • 5. Selections Involving Comparisons 13.5 Can implement selections of the form AV (r) or A  V(r) by using a linear file scan or binary search, or by using indices in the following ways: A6 (primary index, comparison). (Relation is sorted on A) For A  V(r) use index to find first tuple  v and scan relation sequentially from there For AV (r) just scan relation sequentially till first tuple > v; do not use index A7 (secondary index, comparison). For A  V(r) use index to find first index entry  v and scan index sequentially from there, to find pointers to records. For AV (r) just scan leaf pages of index finding pointers to records, till first entry > v In either case, retrieve records that are pointed to – requires an I/O for each record – Linear file scan may be cheaper if many records are to be fetched!
  • 6. Implementation of Complex Selections Conjunction: 1 2. . . n(r) A8 (conjunctive selection using one index). Select a combination of i and algorithms A1 through A7 that results in the least cost fori (r). Test other conditions on tuple after fetching it into memory buffer. A9 (conjunctive selection using multiple-key index). Use appropriate composite (multiple-key) index if available. A10 (conjunctive selection by intersection of identifiers). Requires indices with record pointers. Use corresponding index for each condition, and take intersection of all the obtained sets of record pointers. Then fetch records from file If some conditions do not have appropriate indices, apply test in memory.
  • 7. Algorithms for Complex Selections Disjunction:1 2 . . . n (r). A11 (disjunctive selection by union of identifiers). Applicable if all conditions have available indices. Otherwise use linear scan. Use corresponding index for each condition, and take union of all the obtained sets of record pointers. Then fetch records from file Negation: (r) Use linear scan on file If very few records satisfy , and an index is applicable to  Find satisfying records using index and fetch from file