SlideShare a Scribd company logo
1 of 55
Query Processing and
Optimization
Basic Concepts
2
• Query Processing – activities involved in
retrieving data from the database:
– SQL query translation into low-level language
implementing relational algebra
– Query execution
• Query Optimization – selection of an
efficient query execution plan
Phases of Query Processing
3
Relational Algebra
• Relational algebra defines basic operations on
relation instances
• Results of operations are also relation
instances
4
Basic Operations
• Unary algebra operations:
– Selection
– Projection
• Binary algebra operations:
– Union
– Set difference
– Cross-product
5
Additional Operations
• Can be expressed through 5 basic
operations:
– Join
– Intersection
– Division
6
Selection
σcriterion
(I)
where criterion – selection condition, and I- an
instance of a relation.
• Result:
– the same schema
– A subset of tuples from the instance I
• Criterion: conjunction (AND) and disjunction
(OR)
• Comparison operators: <,<=,=,≠,>=,>
7
Projection
• Vertical subset of input relation instance
• The schema of the result :
– is determined by the list of desired fields
– types of fields are inherited
Πa1,a2,…,am
(I),
where a1,a2,…,am – desired fields from the
relation with the instance I
8
Binary Operations
• Union-compatible relations:
– The same number of fields
– Corresponding fields have the same domains
• Union of 2 relations
• Intersection of 2 relations
• Set-difference
• Cross-product – does not require union-
compatibility
Marina G. Erechtchoukova 9
Joins
• Join is defined as cross-product followed by
selections
• Based on the conditions, joins are classified:
– Theta-joins
– Natural joins
– Other…
10
Theta Join
RCond
S = σCond
(R x S)
Where Cond – refers to the attributes of both
relations R and S in the form of comparison
expressions with operators:
<,<=,=,≠,>=,>
11
Relational Algebra Expressions
• The result of a relational operation is a
relation instance
• Relational algebra expression combines
relation instances using relational algebra
operations
• Relational algebra expression produces the
result of a query
12
Simple SQL Query
SELECT select-list  πselect-list
FROM from-list  Cross Product
WHERE qualification;  σqualification
13
Conceptual Evaluation Strategy for
Simple Query
• Compute the cross-product of tables in from-
list
• Delete those rows which fail the qualification
condition
• Delete all columns that do not appear in the
select-list
• If DISTINCT clause is specified, eliminate
duplicate rows.
14
Nested Queries
• Query block:
– Single SELECT_FROM_WHERE expression
– May include GROUP BY and HAVING
• Query block – basic unit that is translated into
RA expression and optimized
• SQL query is decomposed into query blocks
15
Different Processing Strategies
• Algorithms implementing basic relational
algebra operations
• Algorithms implementing additional relational
algebra operations
• Example:
Find the students who have marks higher than
75 and are younger than 23
16
Query Decomposition
• Analysis
– Relational algebra tree
• Normalization
• Semantic analysis
• Simplification
• Query restructuring
17
Analysis
• Analyze query using compiler techniques
• Verify that relations and attributes exist
• Verify that operations are appropriate for
object type
• Transform the query into some internal
representation
18
Relational Algebra Tree
• Leaf nodes are created for each base relation.
• Non-leaf nodes are created for each intermediate
relation produced by RA operation.
• Root of the tree represents query result.
• Sequence is directed from leaves to root.
19
Relational Algebra Tree (Cont…)
20
Root
Intermediate operations
Intermediate operations
Leaves
…
Criterion Normalization
• Conjunctive normal form – a sequence of boolean
expressions connected by conjunction (AND):
– Each expression contains terms of comparison operators
connected by disjunctions (OR)
• Disjunctive normal form – a sequence of boolean
expressions connected by disjunction (OR):
– Each expression contains terms of comparison operators
connected by conjunction (AND)
21
Criterion Normalization (Cont…)
• Arbitrary complex qualification condition can
be converted into one of the normal forms
• Algorithms for computation:
– CNF – only tuples that satisfy all expressions
– DNF – tuples that are the result of union of tuples
that satisfy the exprssions
22
Semantic Analysis
• Applied to normalized queries
• Rejects contradictory queries:
– Qualification condition cannot be satisfied by any
tuple
• Rejects incorrectly formulated queries:
– Condition components do not contribute to
generation of the result.
23
Relation Connection Graph
• Conjunctive queries without negation
• Each node corresponds to a base relation and
the result
• An edge between two nodes is created:
– If there a join
– If a node is a source for projection.
• If the graph is not connected, the query is
incorrectly formulated
24
Simplification
• Eliminates redundancy in qualification
• Queries against views:
– Access privileges
– Redundancy in qualification
• Transform query to equivalent efficiently
computed form
• Main tool – rules of boolean algebra
25
Queries against Views
• View resolution:
– View select-list is translated into corresponding select-list
in the view defining query
– From-list of the query is modified to hold the names of
base tables
– Qualifications from WHERE clause are combined
– GROUP BY and HAVING clauses are modified
26
Rules of Boolean Algebra
ptruep
pfalsep
falsefalsep
ppp
ppp
≡∧
≡∨
≡∧
≡∨
≡∧
)(
)(
pqpp
pqpp
truepp
falsepp
truetruep
≡∧∨
≡∨∧
≡¬∨
≡¬∧
≡∨
)(
)(
)(
)(
27
Query Restructuring
• Rewriting a query using relational
algebra operations
• Modifying relational algebra expression
to provide more efficient
implementation
28
Query Optimization
• Optimization criteria:
– Reduce total execution time of the query:
• Minimize the sum of the execution times of all
individual operations
• Reduce the number of disk accesses
– Reduce response time of the query:
• Maximize parallel operations
• Dynamic vs. static optimization
29
Heuristic Approach
• Heuristic - problem-solving by experimental
methods
• Applying general rules to choose the most
appropriate internal query representation
• Based on transformation rules for relational
algebra operations
30
Transformation Rules
• Cascade of selection operations:
• Commutativity of selection operations
• Sequence of projection operations
where )...(
)(...
NML
R LNML
∩∩⊂
∏=∏∏∏
)))((()( RR rqprqp σσσσ =∧∧
31
))(())(( RR pqqp σσσσ =
Transformation Rules (Cont…)
• Commutativity of selection and projection
where p involves only attributes from {A1,…,Am}
• Commutativity of binary operations
; ;
;
))(())(( ,...,,..., 11
RR mm AAppAA ∏=∏ σσ
32
RSSR
RSSR pp
×=×
= 
RSSR
RSSR
∪=∪
∩=∩
Transformation Rules (Cont…)
• Commutativity of selection and theta join
• Commutativity of projection and theta join
Where A1contains only attributes from R and A2-
only attributes from S
SRRR rprp  ))(()( σσ =
33
)()()( 2121
SRSR ArArAA ∏∏=∏ ∪ 
Transformation Rules (Cont…)
• Commutativity of projection and union
• Associativity of binary operations
34
)()()( SRSR LLL ∏∪∏=∪∏
).()(
);()(
);()(
);()(
TSRTSR
TSRTSR
TRSTRR
TRSTSR
××=××
=
∩∩=∩∩
∪∪=∪∪

Heirustic Rules
• Perform selection as early as possible
• Combine Cross product with a subsequent
selection
• Rearrange base relations so that the most
restrictive selection is executed first.
• Perform projection as early as possible
• Compute common expressions once.
35
Cost Estimation Components
• Cost of access to secondary storage
• Storage cost – cost of storing intermediate
results
• Computation cost
• Memory usage cost – usage of RAM buffers
36
Cost Estimation for Relational Algebra
Expressions
• Formulae for cost estimation of each
operation
• Estimation of relational algebra expression
• Choosing the expression with the lowest cost
37
Cost Estimation in Query Optimization
• Based on relational algebra tree
• For each node in the tree the estimation is to
be done for:
– the cost of performing the operation;
– the size of the result of the operation;
– whether the result is sorted.
38
Database Statistics for a Relation
• Cardinality of relation instance
• Block (of tuples) – page
• Number of blocks required to store a relation
(data)
• Blocking factor – number of tuples in one
block
• Number of blocks required to store an index
39
Database Statistics for an Attribute of
a Relation
• The number of distinct values
• Possible minimum and maximum values
• Selection cardinality of an attribute:
– For equality condition on the attribute
– For inequality condition on the attribute
40
Algorithms for Relational Algebra
Operations Implementation
• Linear search
• Binary search
• Sort-merge
• External sorting
• Hashing
41
File Organization
• The physical arrangement of data in a file into
records and blocks (pages) on secondary
storage
• Storing and retrieving data depends on the file
organization
42
Heap Files
• Unordered files
• Records are placed in the file in the same
order as they are inserted
• If there is insufficient space in the last block, a
new block is added.
• Records are retrieved based on scan
43
Ordered Files
• Files sorted on the values of the ordering
fields
• Ordering key – ordering fields with unique
constraint
• Under certain conditions records can be
retrieved based on binary search
44
Hash Files
• Records are randomly distributed across the
available space
• To store a record the address of the block (page) is
calculated by Hash function
• Blocks are kept at about 80% occupancy
• To retrieve the data all blocks are scanned which is
about 1.25 times more than for heap files
45
Indexes
• A data structure that allows the DBMS to
locate particular records
• Index files are not required but very helpful
• Index files can be ordered by the values of
indexing fields
46
Retrieval Algorithms
• Files without indexes:
– Records are selected by scanning data files
• Indexed files:
– Matching selection condition
– Records are selected by scanning index files and
finding corresponding blocks in data files
47
Search Space
• Collection of possible execution strategies for a
query
• Strategies can use:
– Different join ordering
– Different selection methods
– Different join methods
• Enumeration algorithm – an algorithm to determine
an optimal strategy from the search space
48
Pipelining
• Materialization - saving intermediate results in
a temporary table
• Pipelining – submitting the results of one
operation to another operation without
creating a temporary table
• A pipeline is implemented for each join
operation
• Requires specific algorithms
49
Linear Trees
• In a linear tree at least one child of a join node
is a base relation
• Left-deep tree – the right child of each join
node is a base relation
• Right-deep tree – the left child of each join
node is a base relation
• Bushy tree – non-linear tree
50
Left-Deep Tree
• Supports fully pipelined strategies
• Advantage:
– Reduces search space
• Disadvantage:
– Excludes alternative strategies which may be of a
lower cost
51
Query Optimization in Oracle
• Rule-based optimizer
– Specify the goal in init.ora file
OPTIMIZER_MODE = RULE
• Cost-based optimizer
– Specify the goal in init.ora file
OPTIMIZER_MODE = CHOOSE
52
Rule-Based Optimizer
• 15 rules are ranked
• RowID describes the physical location of the
record
• RowID is associated with table indeces
• Access path for a table only chosen if
statement contains a predicate or other
construct that makes that access path
available.
53
Cost-Based Optimizer
• Statistics:
– ANALYZE - command to generates statistics
– PL/SQL package DBMS_STAT
• Hints
– To access full table
– To use a rule
– To use a certain index
– …
54
Example
• SELECT /*+ full(student) */ sname FROM
student WHERE Y_of_B = 1983;
55

More Related Content

What's hot

Query processing and Query Optimization
Query processing and Query OptimizationQuery processing and Query Optimization
Query processing and Query OptimizationNiraj Gandha
 
Query processing in Distributed Database System
Query processing in Distributed Database SystemQuery processing in Distributed Database System
Query processing in Distributed Database SystemMeghaj Mallick
 
Query processing and Query Optimization
Query processing and Query OptimizationQuery processing and Query Optimization
Query processing and Query OptimizationNiraj Gandha
 
Protection models
Protection modelsProtection models
Protection modelsG Prachi
 
File organization 1
File organization 1File organization 1
File organization 1Rupali Rana
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMSkoolkampus
 
Ddb 1.6-design issues
Ddb 1.6-design issuesDdb 1.6-design issues
Ddb 1.6-design issuesEsar Qasmi
 
Online analytical processing
Online analytical processingOnline analytical processing
Online analytical processingSamraiz Tejani
 
Cost estimation for Query Optimization
Cost estimation for Query OptimizationCost estimation for Query Optimization
Cost estimation for Query OptimizationRavinder Kamboj
 
Major issues in data mining
Major issues in data miningMajor issues in data mining
Major issues in data miningSlideshare
 
12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMSkoolkampus
 
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESDISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESAAKANKSHA JAIN
 
Query optimization
Query optimizationQuery optimization
Query optimizationdixitdavey
 
Graph representation
Graph representationGraph representation
Graph representationTech_MX
 
Unit 5 composite datatypes
Unit 5  composite datatypesUnit 5  composite datatypes
Unit 5 composite datatypesDrkhanchanaR
 
OLAP operations
OLAP operationsOLAP operations
OLAP operationskunj desai
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization Hafiz faiz
 

What's hot (20)

Query processing
Query processingQuery processing
Query processing
 
Query processing and Query Optimization
Query processing and Query OptimizationQuery processing and Query Optimization
Query processing and Query Optimization
 
Query processing in Distributed Database System
Query processing in Distributed Database SystemQuery processing in Distributed Database System
Query processing in Distributed Database System
 
Query processing and Query Optimization
Query processing and Query OptimizationQuery processing and Query Optimization
Query processing and Query Optimization
 
Protection models
Protection modelsProtection models
Protection models
 
File organization 1
File organization 1File organization 1
File organization 1
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
Database recovery
Database recoveryDatabase recovery
Database recovery
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMS
 
Ddb 1.6-design issues
Ddb 1.6-design issuesDdb 1.6-design issues
Ddb 1.6-design issues
 
Online analytical processing
Online analytical processingOnline analytical processing
Online analytical processing
 
Cost estimation for Query Optimization
Cost estimation for Query OptimizationCost estimation for Query Optimization
Cost estimation for Query Optimization
 
Major issues in data mining
Major issues in data miningMajor issues in data mining
Major issues in data mining
 
12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS
 
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESDISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
 
Query optimization
Query optimizationQuery optimization
Query optimization
 
Graph representation
Graph representationGraph representation
Graph representation
 
Unit 5 composite datatypes
Unit 5  composite datatypesUnit 5  composite datatypes
Unit 5 composite datatypes
 
OLAP operations
OLAP operationsOLAP operations
OLAP operations
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization
 

Viewers also liked

Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...Beat Signer
 
8 query processing and optimization
8 query processing and optimization8 query processing and optimization
8 query processing and optimizationKumar
 
The dag representation of basic blocks
The dag representation of basic blocksThe dag representation of basic blocks
The dag representation of basic blocksShabeen Taj
 
Chapter 6 intermediate code generation
Chapter 6   intermediate code generationChapter 6   intermediate code generation
Chapter 6 intermediate code generationVipul Naik
 
Peephole optimization techniques in compiler design
Peephole optimization techniques in compiler designPeephole optimization techniques in compiler design
Peephole optimization techniques in compiler designAnul Chaudhary
 
Compiler Optimization Presentation
Compiler Optimization PresentationCompiler Optimization Presentation
Compiler Optimization Presentation19magnet
 
Lecture 16 17 code-generation
Lecture 16 17 code-generationLecture 16 17 code-generation
Lecture 16 17 code-generationIffat Anjum
 
Basic Blocks and Flow Graphs
Basic Blocks and Flow GraphsBasic Blocks and Flow Graphs
Basic Blocks and Flow GraphsJenny Galino
 
Chapter Seven(2)
Chapter Seven(2)Chapter Seven(2)
Chapter Seven(2)bolovv
 
Control Flow Analysis
Control Flow AnalysisControl Flow Analysis
Control Flow AnalysisEdgar Barbosa
 
11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMSkoolkampus
 
Query Optimization
Query OptimizationQuery Optimization
Query Optimizationrohitsalunke
 
Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generationrawan_z
 
Three address code In Compiler Design
Three address code In Compiler DesignThree address code In Compiler Design
Three address code In Compiler DesignShine Raj
 

Viewers also liked (20)

Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
 
8 query processing and optimization
8 query processing and optimization8 query processing and optimization
8 query processing and optimization
 
The dag representation of basic blocks
The dag representation of basic blocksThe dag representation of basic blocks
The dag representation of basic blocks
 
Run time administration
Run time administrationRun time administration
Run time administration
 
Chapter 6 intermediate code generation
Chapter 6   intermediate code generationChapter 6   intermediate code generation
Chapter 6 intermediate code generation
 
Peephole optimization techniques in compiler design
Peephole optimization techniques in compiler designPeephole optimization techniques in compiler design
Peephole optimization techniques in compiler design
 
Back patching
Back patchingBack patching
Back patching
 
Compiler Optimization Presentation
Compiler Optimization PresentationCompiler Optimization Presentation
Compiler Optimization Presentation
 
Lecture 16 17 code-generation
Lecture 16 17 code-generationLecture 16 17 code-generation
Lecture 16 17 code-generation
 
Basic Blocks and Flow Graphs
Basic Blocks and Flow GraphsBasic Blocks and Flow Graphs
Basic Blocks and Flow Graphs
 
Code generation
Code generationCode generation
Code generation
 
Chapter Seven(2)
Chapter Seven(2)Chapter Seven(2)
Chapter Seven(2)
 
Query processing
Query processingQuery processing
Query processing
 
Control Flow Analysis
Control Flow AnalysisControl Flow Analysis
Control Flow Analysis
 
Compiler Chapter 1
Compiler Chapter 1Compiler Chapter 1
Compiler Chapter 1
 
11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
 
Chapter15
Chapter15Chapter15
Chapter15
 
Query Optimization
Query OptimizationQuery Optimization
Query Optimization
 
Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
 
Three address code In Compiler Design
Three address code In Compiler DesignThree address code In Compiler Design
Three address code In Compiler Design
 

Similar to Query processing-and-optimization

Deep Dive : Spark Data Frames, SQL and Catalyst Optimizer
Deep Dive : Spark Data Frames, SQL and Catalyst OptimizerDeep Dive : Spark Data Frames, SQL and Catalyst Optimizer
Deep Dive : Spark Data Frames, SQL and Catalyst OptimizerSachin Aggarwal
 
Extending LargeRDFBench for Multi-Source Data at Scale for SPARQL Endpoint F...
 Extending LargeRDFBench for Multi-Source Data at Scale for SPARQL Endpoint F... Extending LargeRDFBench for Multi-Source Data at Scale for SPARQL Endpoint F...
Extending LargeRDFBench for Multi-Source Data at Scale for SPARQL Endpoint F...Holistic Benchmarking of Big Linked Data
 
Iterative Graph Computation in the Big Data Era
Iterative Graph Computation in the Big Data EraIterative Graph Computation in the Big Data Era
Iterative Graph Computation in the Big Data EraWenlei Xie
 
Predicting SPARQL query execution time and suggesting SPARQL queries based on...
Predicting SPARQL query execution time and suggesting SPARQL queries based on...Predicting SPARQL query execution time and suggesting SPARQL queries based on...
Predicting SPARQL query execution time and suggesting SPARQL queries based on...Rakebul Hasan
 
Predicting Multiple Metrics for Queries: Better Decision Enabled by Machine L...
Predicting Multiple Metrics for Queries: Better Decision Enabled by Machine L...Predicting Multiple Metrics for Queries: Better Decision Enabled by Machine L...
Predicting Multiple Metrics for Queries: Better Decision Enabled by Machine L...Soheila Dehghanzadeh
 
Click Log Mining CS598
Click Log Mining CS598Click Log Mining CS598
Click Log Mining CS598Shih-Wen Huang
 
General Tips for participating Kaggle Competitions
General Tips for participating Kaggle CompetitionsGeneral Tips for participating Kaggle Competitions
General Tips for participating Kaggle CompetitionsMark Peng
 
AlphaPy: A Data Science Pipeline in Python
AlphaPy: A Data Science Pipeline in PythonAlphaPy: A Data Science Pipeline in Python
AlphaPy: A Data Science Pipeline in PythonMark Conway
 
Apache Spark Machine Learning
Apache Spark Machine LearningApache Spark Machine Learning
Apache Spark Machine LearningPraveen Devarao
 
Sql query performance analysis
Sql query performance analysisSql query performance analysis
Sql query performance analysisRiteshkiit
 
Strategies for Processing and Explaining Distributed Queries on Linked Data
Strategies for Processing and Explaining Distributed Queries on Linked DataStrategies for Processing and Explaining Distributed Queries on Linked Data
Strategies for Processing and Explaining Distributed Queries on Linked DataRakebul Hasan
 
Parallelizing Pruning-based Graph Structural Clustering
Parallelizing Pruning-based Graph Structural ClusteringParallelizing Pruning-based Graph Structural Clustering
Parallelizing Pruning-based Graph Structural Clustering煜林 车
 
Automatic suggestion of query-rewrite rules for enterprise search
Automatic suggestion of query-rewrite rules for enterprise searchAutomatic suggestion of query-rewrite rules for enterprise search
Automatic suggestion of query-rewrite rules for enterprise searchYunyao Li
 
Sql query performance analysis
Sql query performance analysisSql query performance analysis
Sql query performance analysisRiteshkiit
 

Similar to Query processing-and-optimization (20)

Query driven development
Query driven developmentQuery driven development
Query driven development
 
Deep Dive : Spark Data Frames, SQL and Catalyst Optimizer
Deep Dive : Spark Data Frames, SQL and Catalyst OptimizerDeep Dive : Spark Data Frames, SQL and Catalyst Optimizer
Deep Dive : Spark Data Frames, SQL and Catalyst Optimizer
 
Query compiler
Query compilerQuery compiler
Query compiler
 
Extending LargeRDFBench for Multi-Source Data at Scale for SPARQL Endpoint F...
 Extending LargeRDFBench for Multi-Source Data at Scale for SPARQL Endpoint F... Extending LargeRDFBench for Multi-Source Data at Scale for SPARQL Endpoint F...
Extending LargeRDFBench for Multi-Source Data at Scale for SPARQL Endpoint F...
 
Extended LargeRDFBench
Extended LargeRDFBenchExtended LargeRDFBench
Extended LargeRDFBench
 
Iterative Graph Computation in the Big Data Era
Iterative Graph Computation in the Big Data EraIterative Graph Computation in the Big Data Era
Iterative Graph Computation in the Big Data Era
 
Advanced sql
Advanced sqlAdvanced sql
Advanced sql
 
Predicting SPARQL query execution time and suggesting SPARQL queries based on...
Predicting SPARQL query execution time and suggesting SPARQL queries based on...Predicting SPARQL query execution time and suggesting SPARQL queries based on...
Predicting SPARQL query execution time and suggesting SPARQL queries based on...
 
Predicting Multiple Metrics for Queries: Better Decision Enabled by Machine L...
Predicting Multiple Metrics for Queries: Better Decision Enabled by Machine L...Predicting Multiple Metrics for Queries: Better Decision Enabled by Machine L...
Predicting Multiple Metrics for Queries: Better Decision Enabled by Machine L...
 
Click Log Mining CS598
Click Log Mining CS598Click Log Mining CS598
Click Log Mining CS598
 
General Tips for participating Kaggle Competitions
General Tips for participating Kaggle CompetitionsGeneral Tips for participating Kaggle Competitions
General Tips for participating Kaggle Competitions
 
AlphaPy: A Data Science Pipeline in Python
AlphaPy: A Data Science Pipeline in PythonAlphaPy: A Data Science Pipeline in Python
AlphaPy: A Data Science Pipeline in Python
 
AlphaPy
AlphaPyAlphaPy
AlphaPy
 
Apache Spark Machine Learning
Apache Spark Machine LearningApache Spark Machine Learning
Apache Spark Machine Learning
 
Machine Learning
Machine LearningMachine Learning
Machine Learning
 
Sql query performance analysis
Sql query performance analysisSql query performance analysis
Sql query performance analysis
 
Strategies for Processing and Explaining Distributed Queries on Linked Data
Strategies for Processing and Explaining Distributed Queries on Linked DataStrategies for Processing and Explaining Distributed Queries on Linked Data
Strategies for Processing and Explaining Distributed Queries on Linked Data
 
Parallelizing Pruning-based Graph Structural Clustering
Parallelizing Pruning-based Graph Structural ClusteringParallelizing Pruning-based Graph Structural Clustering
Parallelizing Pruning-based Graph Structural Clustering
 
Automatic suggestion of query-rewrite rules for enterprise search
Automatic suggestion of query-rewrite rules for enterprise searchAutomatic suggestion of query-rewrite rules for enterprise search
Automatic suggestion of query-rewrite rules for enterprise search
 
Sql query performance analysis
Sql query performance analysisSql query performance analysis
Sql query performance analysis
 

More from WBUTTUTORIALS

Software testing-and-analysis
Software testing-and-analysisSoftware testing-and-analysis
Software testing-and-analysisWBUTTUTORIALS
 
Fuzzy logic-introduction
Fuzzy logic-introductionFuzzy logic-introduction
Fuzzy logic-introductionWBUTTUTORIALS
 
Failure mode-and-effects-analysis
Failure mode-and-effects-analysisFailure mode-and-effects-analysis
Failure mode-and-effects-analysisWBUTTUTORIALS
 
Direct memory access
Direct memory accessDirect memory access
Direct memory accessWBUTTUTORIALS
 
Cost volume-profit-relationships
Cost volume-profit-relationshipsCost volume-profit-relationships
Cost volume-profit-relationshipsWBUTTUTORIALS
 
Control unit-implementation
Control unit-implementationControl unit-implementation
Control unit-implementationWBUTTUTORIALS
 
Data communications-concepts
Data communications-conceptsData communications-concepts
Data communications-conceptsWBUTTUTORIALS
 
Ajax toolkit-framework
Ajax toolkit-frameworkAjax toolkit-framework
Ajax toolkit-frameworkWBUTTUTORIALS
 

More from WBUTTUTORIALS (12)

Software testing-and-analysis
Software testing-and-analysisSoftware testing-and-analysis
Software testing-and-analysis
 
Query optimisation
Query optimisationQuery optimisation
Query optimisation
 
Fuzzy logic-introduction
Fuzzy logic-introductionFuzzy logic-introduction
Fuzzy logic-introduction
 
Failure mode-and-effects-analysis
Failure mode-and-effects-analysisFailure mode-and-effects-analysis
Failure mode-and-effects-analysis
 
Direct memory access
Direct memory accessDirect memory access
Direct memory access
 
Cost volume-profit-relationships
Cost volume-profit-relationshipsCost volume-profit-relationships
Cost volume-profit-relationships
 
Control unit-implementation
Control unit-implementationControl unit-implementation
Control unit-implementation
 
Relational model
Relational modelRelational model
Relational model
 
Data communications-concepts
Data communications-conceptsData communications-concepts
Data communications-concepts
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
 
Ajax toolkit-framework
Ajax toolkit-frameworkAjax toolkit-framework
Ajax toolkit-framework
 
Ajax
AjaxAjax
Ajax
 

Recently uploaded

What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 

Recently uploaded (20)

What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 

Query processing-and-optimization

  • 2. Basic Concepts 2 • Query Processing – activities involved in retrieving data from the database: – SQL query translation into low-level language implementing relational algebra – Query execution • Query Optimization – selection of an efficient query execution plan
  • 3. Phases of Query Processing 3
  • 4. Relational Algebra • Relational algebra defines basic operations on relation instances • Results of operations are also relation instances 4
  • 5. Basic Operations • Unary algebra operations: – Selection – Projection • Binary algebra operations: – Union – Set difference – Cross-product 5
  • 6. Additional Operations • Can be expressed through 5 basic operations: – Join – Intersection – Division 6
  • 7. Selection σcriterion (I) where criterion – selection condition, and I- an instance of a relation. • Result: – the same schema – A subset of tuples from the instance I • Criterion: conjunction (AND) and disjunction (OR) • Comparison operators: <,<=,=,≠,>=,> 7
  • 8. Projection • Vertical subset of input relation instance • The schema of the result : – is determined by the list of desired fields – types of fields are inherited Πa1,a2,…,am (I), where a1,a2,…,am – desired fields from the relation with the instance I 8
  • 9. Binary Operations • Union-compatible relations: – The same number of fields – Corresponding fields have the same domains • Union of 2 relations • Intersection of 2 relations • Set-difference • Cross-product – does not require union- compatibility Marina G. Erechtchoukova 9
  • 10. Joins • Join is defined as cross-product followed by selections • Based on the conditions, joins are classified: – Theta-joins – Natural joins – Other… 10
  • 11. Theta Join RCond S = σCond (R x S) Where Cond – refers to the attributes of both relations R and S in the form of comparison expressions with operators: <,<=,=,≠,>=,> 11
  • 12. Relational Algebra Expressions • The result of a relational operation is a relation instance • Relational algebra expression combines relation instances using relational algebra operations • Relational algebra expression produces the result of a query 12
  • 13. Simple SQL Query SELECT select-list  πselect-list FROM from-list  Cross Product WHERE qualification;  σqualification 13
  • 14. Conceptual Evaluation Strategy for Simple Query • Compute the cross-product of tables in from- list • Delete those rows which fail the qualification condition • Delete all columns that do not appear in the select-list • If DISTINCT clause is specified, eliminate duplicate rows. 14
  • 15. Nested Queries • Query block: – Single SELECT_FROM_WHERE expression – May include GROUP BY and HAVING • Query block – basic unit that is translated into RA expression and optimized • SQL query is decomposed into query blocks 15
  • 16. Different Processing Strategies • Algorithms implementing basic relational algebra operations • Algorithms implementing additional relational algebra operations • Example: Find the students who have marks higher than 75 and are younger than 23 16
  • 17. Query Decomposition • Analysis – Relational algebra tree • Normalization • Semantic analysis • Simplification • Query restructuring 17
  • 18. Analysis • Analyze query using compiler techniques • Verify that relations and attributes exist • Verify that operations are appropriate for object type • Transform the query into some internal representation 18
  • 19. Relational Algebra Tree • Leaf nodes are created for each base relation. • Non-leaf nodes are created for each intermediate relation produced by RA operation. • Root of the tree represents query result. • Sequence is directed from leaves to root. 19
  • 20. Relational Algebra Tree (Cont…) 20 Root Intermediate operations Intermediate operations Leaves …
  • 21. Criterion Normalization • Conjunctive normal form – a sequence of boolean expressions connected by conjunction (AND): – Each expression contains terms of comparison operators connected by disjunctions (OR) • Disjunctive normal form – a sequence of boolean expressions connected by disjunction (OR): – Each expression contains terms of comparison operators connected by conjunction (AND) 21
  • 22. Criterion Normalization (Cont…) • Arbitrary complex qualification condition can be converted into one of the normal forms • Algorithms for computation: – CNF – only tuples that satisfy all expressions – DNF – tuples that are the result of union of tuples that satisfy the exprssions 22
  • 23. Semantic Analysis • Applied to normalized queries • Rejects contradictory queries: – Qualification condition cannot be satisfied by any tuple • Rejects incorrectly formulated queries: – Condition components do not contribute to generation of the result. 23
  • 24. Relation Connection Graph • Conjunctive queries without negation • Each node corresponds to a base relation and the result • An edge between two nodes is created: – If there a join – If a node is a source for projection. • If the graph is not connected, the query is incorrectly formulated 24
  • 25. Simplification • Eliminates redundancy in qualification • Queries against views: – Access privileges – Redundancy in qualification • Transform query to equivalent efficiently computed form • Main tool – rules of boolean algebra 25
  • 26. Queries against Views • View resolution: – View select-list is translated into corresponding select-list in the view defining query – From-list of the query is modified to hold the names of base tables – Qualifications from WHERE clause are combined – GROUP BY and HAVING clauses are modified 26
  • 27. Rules of Boolean Algebra ptruep pfalsep falsefalsep ppp ppp ≡∧ ≡∨ ≡∧ ≡∨ ≡∧ )( )( pqpp pqpp truepp falsepp truetruep ≡∧∨ ≡∨∧ ≡¬∨ ≡¬∧ ≡∨ )( )( )( )( 27
  • 28. Query Restructuring • Rewriting a query using relational algebra operations • Modifying relational algebra expression to provide more efficient implementation 28
  • 29. Query Optimization • Optimization criteria: – Reduce total execution time of the query: • Minimize the sum of the execution times of all individual operations • Reduce the number of disk accesses – Reduce response time of the query: • Maximize parallel operations • Dynamic vs. static optimization 29
  • 30. Heuristic Approach • Heuristic - problem-solving by experimental methods • Applying general rules to choose the most appropriate internal query representation • Based on transformation rules for relational algebra operations 30
  • 31. Transformation Rules • Cascade of selection operations: • Commutativity of selection operations • Sequence of projection operations where )...( )(... NML R LNML ∩∩⊂ ∏=∏∏∏ )))((()( RR rqprqp σσσσ =∧∧ 31 ))(())(( RR pqqp σσσσ =
  • 32. Transformation Rules (Cont…) • Commutativity of selection and projection where p involves only attributes from {A1,…,Am} • Commutativity of binary operations ; ; ; ))(())(( ,...,,..., 11 RR mm AAppAA ∏=∏ σσ 32 RSSR RSSR pp ×=× =  RSSR RSSR ∪=∪ ∩=∩
  • 33. Transformation Rules (Cont…) • Commutativity of selection and theta join • Commutativity of projection and theta join Where A1contains only attributes from R and A2- only attributes from S SRRR rprp  ))(()( σσ = 33 )()()( 2121 SRSR ArArAA ∏∏=∏ ∪ 
  • 34. Transformation Rules (Cont…) • Commutativity of projection and union • Associativity of binary operations 34 )()()( SRSR LLL ∏∪∏=∪∏ ).()( );()( );()( );()( TSRTSR TSRTSR TRSTRR TRSTSR ××=×× = ∩∩=∩∩ ∪∪=∪∪ 
  • 35. Heirustic Rules • Perform selection as early as possible • Combine Cross product with a subsequent selection • Rearrange base relations so that the most restrictive selection is executed first. • Perform projection as early as possible • Compute common expressions once. 35
  • 36. Cost Estimation Components • Cost of access to secondary storage • Storage cost – cost of storing intermediate results • Computation cost • Memory usage cost – usage of RAM buffers 36
  • 37. Cost Estimation for Relational Algebra Expressions • Formulae for cost estimation of each operation • Estimation of relational algebra expression • Choosing the expression with the lowest cost 37
  • 38. Cost Estimation in Query Optimization • Based on relational algebra tree • For each node in the tree the estimation is to be done for: – the cost of performing the operation; – the size of the result of the operation; – whether the result is sorted. 38
  • 39. Database Statistics for a Relation • Cardinality of relation instance • Block (of tuples) – page • Number of blocks required to store a relation (data) • Blocking factor – number of tuples in one block • Number of blocks required to store an index 39
  • 40. Database Statistics for an Attribute of a Relation • The number of distinct values • Possible minimum and maximum values • Selection cardinality of an attribute: – For equality condition on the attribute – For inequality condition on the attribute 40
  • 41. Algorithms for Relational Algebra Operations Implementation • Linear search • Binary search • Sort-merge • External sorting • Hashing 41
  • 42. File Organization • The physical arrangement of data in a file into records and blocks (pages) on secondary storage • Storing and retrieving data depends on the file organization 42
  • 43. Heap Files • Unordered files • Records are placed in the file in the same order as they are inserted • If there is insufficient space in the last block, a new block is added. • Records are retrieved based on scan 43
  • 44. Ordered Files • Files sorted on the values of the ordering fields • Ordering key – ordering fields with unique constraint • Under certain conditions records can be retrieved based on binary search 44
  • 45. Hash Files • Records are randomly distributed across the available space • To store a record the address of the block (page) is calculated by Hash function • Blocks are kept at about 80% occupancy • To retrieve the data all blocks are scanned which is about 1.25 times more than for heap files 45
  • 46. Indexes • A data structure that allows the DBMS to locate particular records • Index files are not required but very helpful • Index files can be ordered by the values of indexing fields 46
  • 47. Retrieval Algorithms • Files without indexes: – Records are selected by scanning data files • Indexed files: – Matching selection condition – Records are selected by scanning index files and finding corresponding blocks in data files 47
  • 48. Search Space • Collection of possible execution strategies for a query • Strategies can use: – Different join ordering – Different selection methods – Different join methods • Enumeration algorithm – an algorithm to determine an optimal strategy from the search space 48
  • 49. Pipelining • Materialization - saving intermediate results in a temporary table • Pipelining – submitting the results of one operation to another operation without creating a temporary table • A pipeline is implemented for each join operation • Requires specific algorithms 49
  • 50. Linear Trees • In a linear tree at least one child of a join node is a base relation • Left-deep tree – the right child of each join node is a base relation • Right-deep tree – the left child of each join node is a base relation • Bushy tree – non-linear tree 50
  • 51. Left-Deep Tree • Supports fully pipelined strategies • Advantage: – Reduces search space • Disadvantage: – Excludes alternative strategies which may be of a lower cost 51
  • 52. Query Optimization in Oracle • Rule-based optimizer – Specify the goal in init.ora file OPTIMIZER_MODE = RULE • Cost-based optimizer – Specify the goal in init.ora file OPTIMIZER_MODE = CHOOSE 52
  • 53. Rule-Based Optimizer • 15 rules are ranked • RowID describes the physical location of the record • RowID is associated with table indeces • Access path for a table only chosen if statement contains a predicate or other construct that makes that access path available. 53
  • 54. Cost-Based Optimizer • Statistics: – ANALYZE - command to generates statistics – PL/SQL package DBMS_STAT • Hints – To access full table – To use a rule – To use a certain index – … 54
  • 55. Example • SELECT /*+ full(student) */ sname FROM student WHERE Y_of_B = 1983; 55