Вы находитесь на странице: 1из 104

Course Code : M.

Sc11

RDBMS
Session – 1 & 2

PCTI Limited - A Unique Name For Quality Education


RDBMS
(Relational Data Base Management
Systems)
DBMS:A management and
planning system for creation,
modification of database and
distribution of access rights
of database among its users
PCTI Limited - A Unique Name For Quality Education
DBMS Approaches
 Hierarchical Systems
 Networked Systems
 Relational Systems
 Object Oriented
Systems

PCTI Limited - A Unique Name For Quality Education


Introduction
Relational Systems
In relational systems the
database items are categorized
into :
1.Entities
2.Attributes
3.Relationship
PCTI Limited - A Unique Name For Quality Education
Features of RDBMS

•Data Storage and Retrieval


•Multi user Support
•Security
•Database Recovery
•Concurrency Control

PCTI Limited - A Unique Name For Quality Education


Keys
•Primary Key
•Composite Key
•Candidate Key
•Alternate key
•Secondary key
•Foreign Key
PCTI Limited - A Unique Name For Quality Education
CODD’s Twelve Rules of RDBMS
Rule Zero: A relational system must
be able to manage database entirely
through its relational capabilities.
Any DBMS that advises users to
resort to some non-relational
capabilities to achieve acceptable
performance should be interpreted
as an apology by the vendor.

PCTI Limited - A Unique Name For Quality Education


Rule One: The Information
Rule
All information in a relational
database is represented
explicitly at the logical level and
in exactly one way – by values
in tables.

PCTI Limited - A Unique Name For Quality Education


Rule Two: Rule of
guaranteed access
Each and every datum in a
relational database is
guaranteed to be logically
accessible by resorting to a
combination of table name,
primary key value and column
name.
PCTI Limited - A Unique Name For Quality Education
Rule Three: Systematic
treatment of null values
Null values are supported for
representing missing
information and inapplicable
information in a systematic
way independent of data
type
PCTI Limited - A Unique Name For Quality Education
Rule Four: The Database
description Rule
The database description is
represented at the logical level in the
same way as ordinary data so that
authorized users can apply the same
relational language to its
interrogation as they apply to the
regular date.

PCTI Limited - A Unique Name For Quality Education


Rule Five: Comprehensive
Sub-language rule
A relational system may support several
languages and various modes terminal
use. However, there must be at least one
language whose statements can express
all of the following:
Data Definition, View Definition, Data
Manipulation, Integrity constraint,
Authorization, Transaction Boundaries.

PCTI Limited - A Unique Name For Quality Education


Rule Six: View updation
rule
All views that are
theoretically updateable are
also updateable by the
system.

PCTI Limited - A Unique Name For Quality Education


Rule Seven: Insert / Delete /
Update Rule
The capability of handling a base
relation or a derived relation as a
single operand applies not only
to the retrieval of the data but
also to the insertion, updation,
and deletion.

PCTI Limited - A Unique Name For Quality Education


Rule Eight: Physical Data
Independence Rule
Application programmes and
terminal activities remain
logically unimpaired
whenever any changes are
made in either storage
representation or access
methods.
PCTI Limited - A Unique Name For Quality Education
Rule Nine: Logical data
independence rule
Application programmes and
terminal activities remain
logically unimpaired when
information-preserving changes
of any kind that theoretically
permit unimpairment are made
to the base tables.
PCTI Limited - A Unique Name For Quality Education
Rule Ten:Integrity Rules
•Entity Integrity
•Referential Integrity

PCTI Limited - A Unique Name For Quality Education


Rule Eleven: The Distribution
Rule
The data manipulation data sub
language of a Relational DBMS
must enable application
programmes and enquires to
remain logically the same
whether data is physically
centralized or distributed.

PCTI Limited - A Unique Name For Quality Education


Rule Twelve: No
subversion Rule
If a Relational system has a low
level language, that low level
cannot be used to subvert or
bypass the integrity rules and
constraints expressed in the
higher-level relational
languages.
PCTI Limited - A Unique Name For Quality Education
DBMS Task Force
1. System Catalog
2. Runtime Database
Processor
3. Stored Data Manager
4. Query Compiler
5. Precompiler

PCTI Limited - A Unique Name For Quality Education


System Catalog
System catalog is an essential
part of any DBMS which
contains the information
about the data stored in
DBMS or the data that may
help in the storage or retrieval
of it. For example the
information about constraints
on a table, size and domain of
attributes, their logical storage
structures etc.
PCTI Limited - A Unique Name For Quality Education
Runtime Database
Processor
The optimized query code
reaches the query processor
and it is actually the query
processor (RDP) who works
out with a query and does all
the necessary operations
needed to perform it. For its
completion it needs to take
extra help of system catalog
and stored data manger.

PCTI Limited - A Unique Name For Quality Education


Stored Data
Manager
All the operations on the
database can be carried out
only with the help of disk
manager (SDM). The disk
manager is high level version
of the operating system and
the access to any of the data-
structures of the data stored
inside can be done by stored
data manager only.

PCTI Limited - A Unique Name For Quality Education


Query Compiler
Before a query comes to its
execution it is scanned for its
syntactical, logical or any of
the access control errors. This
tedious task is in fact
completed by a smart suite
called query compiler. The
query compiler after validating
the query generates an
intermediate code and then
converts it into an optimized
code.
PCTI Limited - A Unique Name For Quality Education
Precompiler
The action of precompiler
comes into play when the
query to be executed needs
to be modified before its
compilation. Also in the
case of data-sublanguage
when needs to be separated
from host language the
precompiler comes into the
picture.
PCTI Limited - A Unique Name For Quality Education
Data Models
Data models are concepts that
are required to describe the
database items. These items
may be about the data itself,
metadata, or the description of
associations with the data or
metadata.
The data models are :
 High Level
 Implementational Level
 Low level
PCTI Limited - A Unique Name For Quality Education
ANSI/SPARC Layers
The ANSI/SPARC model of a
DBMS consists of three layers.
All these layers have their own
independent tasks and are
capable of performing specific
actions depending upon the
business rules. However certain
protocols must be followed by
each of the layers. These
protocols include mapping of
data and associated material for
better communication.
PCTI Limited - A Unique Name For Quality Education
External Schema
The schema deals with the
external view that has been
provided to the naive user of the
system. The external schema thus
is a collection of the concepts
required to describe those data
items that are exposed to the end-
user. As obvious we use high level
data model to describe it.
The user of the external schema
needs only to know the facts
related to it and nothing else.
PCTI Limited - A Unique Name For Quality Education
Conceptual Schema
The concepts that describe the
logical view of database items
including the external schema
are devised here. For example
there may be more than one
tables represented in conceptual
layer of DBMS and a view is given
to the user in the external
schema that is mixture of the
two tables in the conceptual
schema. The database designers
need to know these concepts.
PCTI Limited - A Unique Name For Quality Education
Internal
Schema
The tables that has been created or are
present in conceptual schema are
logical one…..so the actual data also is
needed to be stored on the disk. Now
the model of the data that has been
collected according to logical schema
concepts needs to be organized in an
easy form so as to facilitate searching
and storing efforts.
So all the file organization concepts
and disk organization must be handled
by low level programmers of the
database.
PCTI Limited - A Unique Name For Quality Education
Session - 3

Includes:
a) Data Independence
b) ER Modelling

PCTI Limited - A Unique Name For Quality Education


Data-Independence

 Logical Data Independence


Conceptual schema can be
modified without affecting
external schema.
 Physical Data Independence
Physical schema can be
modified without affecting
conceptual schema.

PCTI Limited - A Unique Name For Quality Education


E-R Modeling
The database items are categorized into :
Entities : A real life object of real and
independent existence. E.G
ram,flat, computer
Entity type : the abstracted name to
which an entity
belongs. For ex. Ram belongs
to entity type PersonType.
Entity set : the abstracted group to which
an entity belongs.
Ex. PersonType may be having
elements like ram,Mohan etc.
PCTI Limited - A Unique Name For Quality Education
Relationships

Relationship Type: It represents nature


of binding of two entity types.
Relationship Instance : The specific
binding between two entities.

r1 y1
x1
r2 y2
x2
r3 y3
x3
* * *
* *
*

Employee Works_For Department


PCTI Limited - A Unique Name For Quality Education
Important

 No. of entity types participating in a


relationship type is called degree of
relationship type. A binary ( degree
2) relationship type has two entity
types participating in it.
 Binary relationship type has
cardinality ratio as 1:1,1:M,M:1,M:N
 There may also be certain
constraints for an entity type to
participate in a relationship type.
PCTI Limited - A Unique Name For Quality Education
Participation Constraints
 When an entity type must
participate in a relationship type
it is said as the existence
dependency of that entity type.
 The relationship type in which it
participates is called identifying
relationship
 There is partial participation
constraint when there is
relaxation from above
participation bindings

PCTI Limited - A Unique Name For Quality Education


Weak/Strong Entity Types
Weak Entity Type is classified as it
doesn’t possess a key.(They have
discriminator)
Strong Entity Type always has a key.

Every weak entity type has


existence dependency w.r.t
some relationship type but the
converse is not true.

PCTI Limited - A Unique Name For Quality Education


Recursive Relationships

A relationship type is said to be recursive


when an entity type participates in it in
more than one roles.

r1 x1
x1
r2 x2
x2
r3 x3
x3
* *
*
* *
*

Degree of recursive relationship is 1

PCTI Limited - A Unique Name For Quality Education


Session-4

Includes :
a)Domain Of Attributes
b)Attribute Values
c)Null Values
d)EER-Concepts

PCTI Limited - A Unique Name For Quality Education


Domain Of Attributes
Domain of an ‘’attribute’’ of an entity
type is the set of values that it can
assume.
For Example : NamePer is attribute
of entity type PersonType which
can assume its value from the
group of the strings made up of
characters from A-Z and a-z only
including blank space character.

PCTI Limited - A Unique Name For Quality Education


Attributes Values

 Atomic
(single value)  Derived
(derived values)
 Composite
(mixture values)  Key
( unique value)
 Multi-valued
(added values)  Complex
( tree value)

PCTI Limited - A Unique Name For Quality Education


NULL Values

If an Attribute Has a Null


Value Then It May Have More
Than One Meanings.

For Example : Non Available or


a Non-
applicable Item
PCTI Limited - A Unique Name For Quality Education
Enhanced ER Model Intro
 Super Class  Sub Class

 Classification  Instantiation

 Aggregation  Association

 Generalization  Specialization

PCTI Limited - A Unique Name For Quality Education


Session-5
Includes :

Relational Algebra

PCTI Limited - A Unique Name For Quality Education


Relational Algebra

In addition to defining the database


structure and constraints, a data
model must include a set of
operations to manipulate the data.
Relational algebra is a procedural
language which defines a set of
operations that may be needed to
perform for the evaluation of a query.
The operands are relations and also
the results.
PCTI Limited - A Unique Name For Quality Education
Relational Algebra Operations

 The relational algebra operations are


divided into two groups. One group
includes set operations from
mathematical set theory; these are
applicable because each relation is
defined to be a set of tuples. Set
operations include UNION,
INTERSECTION , DIFFERENCE, and
CARTESIAN PRODUCT. The other
group consists of SELECT, PROJECT,
and JOIN, among
PCTI Limited others.
- A Unique Name For Quality Education
Select Operation

The SELECT operation is used to select a


subset of the tuples from a relation that
satisfy a selection condition. One can
consider the SELECT operation to be a filter
that keeps only those tuples that satisfy a
qualifying condition.

In general, the SELECT operation is


denoted by
<selection condition> ( R )
PCTI Limited - A Unique Name For Quality Education
PROJECT Operation
The PROJECT operation, selects
certain columns from the table
and discards the other columns.
If we are interested in only certain
attributes of a relation, we use the
PROJECT operation to project the
relation over these attributes only.
The general form of the PROJECT
operation is :
<attribute list> ( R )

PCTI Limited - A Unique Name For Quality Education


JOIN Operation
The JOIN operation is used to
combine related tuples from two
relations into single tuples. The
general form of a JOIN operation
on two relations R (A1, A2, …, An)
and S (B1, B2, …, Bm) is:
R <join condition>S
The result of the JOIN is a relation
Q with n + m attributes.

PCTI Limited - A Unique Name For Quality Education


Division Operation
The DIVISION operation is useful
for a special kind of query that
sometimes occurs in database
application. In general, the
DIVISION operation is applied to
two relations R(Z)  S(X), where X
 Z. Let Y = Z – X (and hence Z =
X U Y); that is, let Y be the set of
attributes of S.

PCTI Limited - A Unique Name For Quality Education


Session-6
Includes:
a) Introduction to File Organization

b) Types Of Keys

c) Dependencies

PCTI Limited - A Unique Name For Quality Education


File Organization

Study for management of the


operations on a file of records for
the better performance issues and
various data-structures which help
in doing so.

The study includes space and time


complexity issues for retrieval and
storage and corresponding
algorithm design for the purposes.
PCTI Limited - A Unique Name For Quality Education
Types of Keys

 Super Key : Set of attributes which


guarantee to uniquely identify a row.
This implies that no two tuples of that
relation have all the attribute values
same that belong to this set.
 Key : Minimal set of attributes with the
same feature as that of superkey such
that if any of the attributes is removed,
the remaining of the attributes may not
retain the unique identification property.

PCTI Limited - A Unique Name For Quality Education


Types Of Keys

 Candidate Key : A relation may have


more than one key. All these keys
are called candidate keys.
 Primary Key : Depending upon the
relation and type of use anyone of
the candidate keys may be assigned
as the primary key of that relation.
 Alternate key : Candidate keys
except the primary key are called
alternate keys.

PCTI Limited - A Unique Name For Quality Education


 Those attributes which do belong to any
of the candidate keys are called prime
attributes otherwise the attributes are
called non-prime attributes.

 The word key is interchangeably called as


minimal key.

PCTI Limited - A Unique Name For Quality Education


Functional Dependency
Assume a relation R. Let there be
two subsets X and Y of R such
that X->Y.
It follows that attributes of set Y
are functionally determinable by
attributes of set X.
Let y = f(x). Here y is a dependent
variable and x is independent
variable. Value of x determines the
fate of value of y.

PCTI Limited - A Unique Name For Quality Education


Full/Partial Dependencies
From the last example if the
removal of any attribute from the
set X does not guarantees to
determine the attributes of set Y
the functional dependency is full-
functional dependency otherwise if
the above statement does not
holds the dependency is partial
dependency.

PCTI Limited - A Unique Name For Quality Education


Transitive Dependency

Let there be a set of attributes X


that determines Y. Also there be a
set of attributes Y that determines
Z.Then X->Z
is also true and this dependency
is called transitive dependency.
Mathematically, if X->Y and Y->Z
then
X->Z
PCTI Limited - A Unique Name For Quality Education
Session-7
Includes:
Normalization Process
a)First Normal Form
b)Second Normal Form
c)Third Normal Form

PCTI Limited - A Unique Name For Quality Education


Normalization

Normalization of a relation is
the process to possibly
decompose a relation into sub
parts such that the
decomposed subparts may
have less redundancy and still
the relation access algorithms
work efficiently.
PCTI Limited - A Unique Name For Quality Education
Normalization Process

 Normalization process includes a series


of mathematical decomposition steps and
the no. of steps utilized tells us the
degree of wanted normalization. The
various steps are:
 First Normal Form.
 Second Normal Form.
 Third Normal Form.
 Fourth Normal Form.
 Project Join Normal Form etc.

PCTI Limited - A Unique Name For Quality Education


First Normal Form
A relation must satisfy the following
two conditions in order to be in
first NF.

 Attributes must have unique,


atomic values

 There should be no nested


relations

PCTI Limited - A Unique Name For Quality Education


Second Normal Form
The relation satisfying second
normal form must possess full-
functional dependency.

That means to say that ‘’every


non-keyed attribute must be fully-
functionally dependent on the
primary key of the relational.’’

PCTI Limited - A Unique Name For Quality Education


Third Normal Form

Third normal form suggests to


remove all the transitive
dependencies from the relation.
In other words a relation schema is
said to be in third normal form if all
dependencies are of the type X->A
such that :
a) X is a superkey or,
b) A is prime attribute

PCTI Limited - A Unique Name For Quality Education


Session-8
Includes:
a)Recap Third Normal Form
b)Boyce-Codd Normal Form
c)Multivalued Dependencies

PCTI Limited - A Unique Name For Quality Education


Boyce-Codd Normal Form

Boyce-Codd normal form is quite


stricter than the third normal
form and does not allows the
condition b) of the third normal
form which allows the attribute to
be prime.

PCTI Limited - A Unique Name For Quality Education


Multi-valued Dependency(X->>Y)
Multi-valued dependency is the direct
consequence of the first normal form
and is caused because of the
occurrence of independent functional
dependencies.
Statement : Let there be a relation
schema R(X,Y,Z). Whenever two
tuples exist that have distinct
values of Y but the same values of X,
these values of Y must be repeated
in separate tuples with every
distinct value of Z that occurs with
the same value of X.

PCTI Limited - A Unique Name For Quality Education


Session-9
Includes
a) Recap Multivalued
Dependencies
b) Fourth Normal Form
c) Lossless join decomposition

PCTI Limited - A Unique Name For Quality Education


Fourth Normal Form

Statement : A relation schema R


w.r.t a set of functional
dependencies is in 4NF if for every
non-trivial MVD X->>Y in F+
X is a superkey of R.

PCTI Limited - A Unique Name For Quality Education


Lossless Join Decomposition
The relation schemas A and B
form a lossless join decomposition
if and only if :

(AB) ->> (A-B) or


(A B)->> (B-A).
This is because of the symmetry
in the definition.

PCTI Limited - A Unique Name For Quality Education


Session-10
Includes :
a) Join dependencies
b)PJNF(Fifth Normal Form)
c) Recap Normalization

PCTI Limited - A Unique Name For Quality Education


Join Dependencies
 The constraint says that every
legal state r of R should have a
lossless join decomposition into,
R1, R2, R3,……Rn
In other words projected Cartesian
product of the decomposed
relations over the original relation
must give the original relational
state R of the system.

PCTI Limited - A Unique Name For Quality Education


Session-11
Includes:
a) Need for Concurrency Control
b) Locking Models

PCTI Limited - A Unique Name For Quality Education


Concurrency Control
In distributed and muti-user
databases various users working
on the same database may issue
their queries simultaneously. The
problems lie in handling them
such that the modification of the
database may keep it in a
consistent state, and also their
should not be any compromise
with the efficiency and speed in
doing so.
PCTI Limited - A Unique Name For Quality Education
Locking Models
In order to process a query it may
several times be required to lock
an item to avoid its use by any
other module. So the locking
schemes are :
 Binary locking
 Shared/exclusive locking
 Two phase locking
 Time stamping

PCTI Limited - A Unique Name For Quality Education


Binary Locks

This locking scheme believes in


either assertive or rejection
response to the transaction that
wants to access an item. If the
item is currently in use by any
other transaction, the request is
rejected, otherwise accepted.

PCTI Limited - A Unique Name For Quality Education


Shared/exclusive locking

The locks have been categorized as


read lock or write lock.
If a transaction has acquired a read
lock over an item then the locking
scheme may accept a read request
over the same item and will simply
deny write attempt to that item.

PCTI Limited - A Unique Name For Quality Education


Shared/exclusive locking
In the same context however if
there is write lock acquired over
an item, then any request either
read or write will be simply
rejected and is exclusively
available to the transaction that is
using it for updation.

PCTI Limited - A Unique Name For Quality Education


Two Phase Locking
In the context to get serializability
it has been suggested to design a
transaction schedule such that,
there are only two phases of lock
acquisition and lock release.
While the lock acquisition phase
all the transactions can just
acquire a lock over an item while
lock release phase all the
transactions can just release their
locks.

PCTI Limited - A Unique Name For Quality Education


Session-12
Includes:
a) Deadlocks

b) Starvation

c) Timestamping

PCTI Limited - A Unique Name For Quality Education


Deadlocks
A deadlock is said to occur when a
transaction is waiting for a database
item lock acquisition, however is also
having locks over other items. So in the
sequence other transactions have
acquired a lock over the item it
requires and are again waiting for other
item locks. This over all chain to get a
lock creates deadlock. The situation get
worst if none of the transactions can be
aborted for retry.

figure

PCTI Limited - A Unique Name For Quality Education


Wait for I2

T1/I1 T2/I2

T4/I4 T3/I3

Wait for I4

Back
PCTI Limited - A Unique Name For Quality Education
Starvation
Starvation is a terminology given
to those transactions which are
waiting for a long time to acquire
locks and are failed ever to get it
till the moment.
Starvation mainly happens with
those transactions which have
lesser priorities than others.

PCTI Limited - A Unique Name For Quality Education


Timestamping
Timestamping is the technique to
attach a unique identifier with
every transaction in the order of
their commencement and can be
done by system clock or a
counter.
The two defined timestamps are:
a) Read(X)
b) Write(X)

PCTI Limited - A Unique Name For Quality Education


Timestamping
 Read(x).
Largest among all the timestamps
that have successfully read item
x.
 Write(x).
Largest among all the timestamps
that have successfully written
item x.

PCTI Limited - A Unique Name For Quality Education


Timestamp Ordering
 Write(x) operation
If Read(x) > TS(t) or if
Write(x)>TS(t) then abort or
rollback t; reject the operation.
Otherwise accept.
 Read(x) operation
If Write(x)>TS(t), then abort and
rollback t ; reject the operation.
Otherwise accept.

PCTI Limited - A Unique Name For Quality Education


Session-13
Includes:
a) Serializability Concepts
b) Serial Schedules
c) Serializable and
Conflict Serializable
Schedules

PCTI Limited - A Unique Name For Quality Education


Serializabilty Concepts
The simple problems found in the
multiuser systems are:
a) Lost-Update problem
b) Dirty-Read problem
In order to get the consistency in
the multi user systems it requires
the use of additional techniques to
manage the flow of transactions
coming regularly from various
terminals.
PCTI Limited - A Unique Name For Quality Education
Serial Schedules
A schedule with n transactions is
said to be serial schedule, if all the
operations belonging to a
particular transaction follow the
operations of the other
transactions in sequence.
Mathematically there, are possible
n! serial schedules of n
transaction set.Obviously, many
more non-serial schedules are
also possible.
PCTI Limited - A Unique Name For Quality Education
Serializable Schedules
The schedules with their effect
equivalent to any serial schedule
is called as serializable schedule.
If there is a sequence of read and
write operations on the same item
from the different transactions the
prescribed schedule is termed to
have conflict. However again if the
its effect is equivalent to any other
serial schedule then such a
schedule is called conflict
serializable schedule.
PCTI Limited - A Unique Name For Quality Education
Session-14
Includes:
a) Backup and Recovery Needs
b) Recovery Concepts
c) Disk Caching
d) Checkpointing

PCTI Limited - A Unique Name For Quality Education


Backup And Recovery
However much efforts have already
been made for a secure transaction
channel still many possibilities are
there to disrupt the integrity and
consistency of the database.
In order to prevent the database from
technical failures like
software/hardware failure failures and
power supply we can implement a few
techniques depending upon the system
in use.

PCTI Limited - A Unique Name For Quality Education


Recovery Concepts

The two main strategies for


recovery from non-catastrophic
failures are:
1) Deferred Update
2) Immediate Update

PCTI Limited - A Unique Name For Quality Education


Disk Caching

The simple principle lies in storing


the items that are in current use in
the DBMS cache. The idea is as
simple as page table in case of
operating systems.
The referred database item is firstly
searched in DBMS cache, if not
found is loaded from disk and the
DBMS cache is updated.

PCTI Limited - A Unique Name For Quality Education


Checkpointing
When a transaction is said
“committed” the write operation is
updated on the database and
correspondingly the log is updated
with a checkpoint so that when
next time there is a failure there is
no need of repeating the write
operation in the database.

PCTI Limited - A Unique Name For Quality Education


Session-15
Includes:
a) Transaction Rollback
b) Shadow paging

PCTI Limited - A Unique Name For Quality Education


Transaction Rollback

If a transaction fails to reach commit


point then all modifications it has made
must be cancelled. In order to do so it
uses a “savepoint” for the transactions
that need to be undone out of a series of
transactions.
If a series of transactions is dependent
on each other, rollback of an underlying
transaction may result into the roll back
of all the transactions above it and
hence the “cascading rollback”.

PCTI Limited - A Unique Name For Quality Education


Shadow Paging

 Method considers the database to be


made up of fixed sized disk pages and a
directory.
 There are two directories current
directory and shadow directory.
 For any modification current directory
refers the modified page and shadow
directory contains old page.
 In case of any discrepancy the
transaction can be undone using
shadow directory.

PCTI Limited - A Unique Name For Quality Education


Session-16
Includes:
a) Query Optimization Basics
b) Query Evaluation
c) Query optimizer/Query Tree
d) Join Operation Implementation

PCTI Limited - A Unique Name For Quality Education


Query Optimization
While evaluating a query issued
query processor needs to perform
a sequence of mathematical
operations. These operations can
however be lessen by optimizing
the query into an equivalent
query. The optimization of a query
refers to an economical equivalent
depending upon the system
configuration.

PCTI Limited - A Unique Name For Quality Education


Query Evaluation Steps
1. Scanning/Parsing/Validating
2. Query Optimizer
3. Query Code Generator
4. Query Processor
After being scanned intermediate
code of the query is passed and
the query optimizer checks it for
its optimality. Then its working
code is constructed that is passed
for the real execution.

PCTI Limited - A Unique Name For Quality Education


Query Optimizer/Query Tree

While optimizing a query a query


tree is developed. A query tree thus
formed is optimized in such a way
that lesser no. of operations need
to be performed.
One of the main issues is to reduce
the cartesian products while
joining two tables. So first we
perform selection operations if any,
and then work with cartesian
products.
PCTI Limited - A Unique Name For Quality Education
 LNAME

ESSN=SSN

 ESSN  SSN,LNAME

PNUMBER=PNO BDATE >’1957-12-1’

 PNUMBER  ESSN,PNO
EMPLOYEE

PNAME=‘Aquarius’ WORKS_ON

PROJECT

PCTI Limited - Aconvert


Steps to Unique aName
tree For Quality
during Education
heuristic optimization
Implementation of Join Operation

There are three simple methods of


implementing the join operation.
 Nested loop join
 Single loop join
 Sort-merge join

PCTI Limited - A Unique Name For Quality Education

Вам также может понравиться