7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
1/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
CS9152 DATABASETECHNOLOGY
UNIT IV
DATABASE DESIGN ISSUES
TEXT BOOK
1. Elisa Bertino, Barbara Catania, Gian Piero Zarri, Intelligent Database Systems,Addison-esley, !""1.
REFERENCES
1. Carlo Zaniolo, Ste#ano Ceri, C$ristos %alo&stsos, '.(.Snodgrass, ).S.S&bra$manian,
Ad*an+ed Database Systems, organ aman, 1/.!. 0.(amer 2s&, Patri+3 )ald&rie2, Prin+i4les o# Distrib&ted Database Systems,
Prenti+e 5al International In+. , 1.
6. C.S.' Prab$&, b7e+t-riented Database Systems, Prenti+e 5all # India, 18.9. Abd&lla$ :2 (ansel Et Al, (em4oral Databases; ($eory, Design And
Prin+i4les,Ben7amin C&mmings P&blis$ers , 16.
5ill, ($ird Edition, !""9.?. 5enry % ort$, Abra$am Silbers+$at2, S. S&d$ars$an, Database System Con+e4ts,
%o&rt$ Ediion, +Gra> 5ill , !""!.
/. '. Elmasri, S.B. 0a*at$e, %&ndamentals o# Database Systems, Pearson Ed&+ation,!""9.
DATABASE DESIGN ISSUES
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
2/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
Syllab!"
UNIT IV DATABASE DESIGN ISSUES 1#
ER $%&'l N%()al*+a,*% S'.(*,y I,'/(*,y C%!*!,'.y Da,aba!'
T*/ O0,*)*+a,*% a& R'!'a(. I!!'! D'!*/ % T')0%(al Da,aba!'!
S0a,*al Da,aba!'!3
Tabl' % C%,',!
SL N%3 T%0*. 4a/'
1 ER $%&'l 2
2 N%()al*+a,*% 1
S'.(*,y 26
7 I,'/(*,y #
5 C%!*!,'.y 2
8 Da,aba!' T*/
6 O0,*)*+a,*% a& R'!'a(. I!!'! 9
D'!*/ % T')0%(al Da,aba!'! 72
9 S0a,*al Da,aba!'! 76
1# Sa)0l' :'!,*%! 5
11 U*;'(!*,y :'!,*%! 8#
T%0*. 1" ER $%&'l
DATABASE DESIGN ISSUES !
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
3/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
I,(%&.,*%
A database +an be modeled as;
a +olle+tion o# entities,relations$i4 among entities.
Ste4s in design o# database;-
@ 'e&irements +olle+tion analysis@ Con+e4t&al s+$ema design
@ Im4lementing +on+e4t&al s+$ema into database &sing Im4lementation model
logi+al database design or data model ma44ing
@ P$ysi+al database design
5ig$-le*el +on+e4t&al data model
ER $%&'l C%.'0,!
E,*,*'!< a,,(*b,'! a& ('la,*%!*0!
E,*,*'!are s4e+i#i+ ob7e+ts or t$ings in t$e mini->orld t$at are re4resented in t$e
database.
An entity is an ob7e+t t$at eists and is disting&is$able #rom ot$er
ob7e+ts.Eam4le; s4e+i#i+ 4erson, +om4any, e*ent, 4lant
%or eam4le, t$e EPEE =o$n Smit$, t$e 'esear+$ DEPA'(E0(, t$e
Prod&+tF P'=EC(
E,*,y S',; A +olle+tion o# similar entities. E.g., all em4loyees.
All entities in entity set $a*e same set o# attrib&tes.
Ea+$ entity set $as a key.
Ea+$ attrib&te $as a domain.
A,,(*b,'!"
Attrib&tes are 4ro4erties &sed to des+ribe an entitiy.
%or Eam4le, an EPEE entity may $a*e a 0ame, SS0, Address, Se,
Birt$Date.
A S4e+i#i+ entity >ill $a*e a *al&e #or ea+$ o# its attrib&tes.
DATABASE DESIGN ISSUES 6
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
4/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
%or eam4le a s4e+i#i+ em4loyee entity may $a*e 0ameH=o$n Smit$,
SS0H1!69
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
5/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
single *al&ed - age
m<i *al&ed - &ali#i+ation
stored - dateo#birt$
deri*ed - Age
Nll ;al'!
@ issing
@ A*ailable b&t &n3no>n
@ Ina44li+able 4la+es
@ E,*,y ,y0'!< ;al' !',! = K'y a,,(*b,'!
Entity ty4e entities t$at s$are same attrib&tes or entities >it$ t$e same basi+
attrib&tes are gro&4ed or ty4ed into an entity ty4e
JegK em4loyee
@ des+ribes s+$ema or intension #or a set o# entities
Colle+tion o# indi*id&al entities etension o# entity ty4e or entity set
@ Val' !', >&%)a*? % a,,(*b,'!
@ name, ty4e o# *al&es, #ormat et+.
K'y a,,(*b,' % a ',*,y ,y0' - An attrib&te o# Entity ty4e #or >$i+$ ea+$ entity
m&st $a*e a &ni&e *al&e is +alled a 3ey attrib&te o# t$e entity ty4e.
It doesnt allo> d&4li+ate *al&es
Eam4le, SS0 o# EPEE
An entity ty4e may $a*e more t$an one 3ey.
%or eam4le, t$e CA' entity ty4e may $a*e t>o 3eys;
- )e$i+leIDenti#i+ation0&mber J4o4&larly +alled )I0K and
DATABASE DESIGN ISSUES
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
6/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
- )e$i+le(ag0&mber J 0&mber, stateK, alos 3no>n an li+ense4late
n&mber
-
@ RELATIONSHI4S
Asso+iation among entity ty4es
'elations$i4 ty4e set o# relations$i4s among di##erent entity ty4esE1,E!,L,En entity ty4esQ
r1,r!,L,rn relation instan+es
' relations$i4 ty4e
E.g., Attis$oo >or3s in P$arma+y de4art.
R'la,*%!*0 S'," Colle+tion o# similar relations$i4s.
An n-ary relations$i4 set ' relates n entity sets E1 ... EnQ
ea+$ relations$i4 in ' in*ol*es entities e1 #rom E1, ..., en #rom En
@ Same entity set +o&ld 4arti+i4ate in di##erent relations$i4 sets,or in di##erent roles in same set.
C%!,(a*, % R'la,*%!*0!
- I( is alos 3no>n as ratio +onstraints
- aim&m Cardinality- ne-to-one J1;1K
- ne-to-many J1;0K or many-to-one J0;1K
- any-to-many
- inim&m Cardinality Jalso +alled 4arti+i4ation +onstraint or eisten+e
de4enden+y +onstraintsK
- Zero Jo4tional 4arti+i4ation, not eisten+e-de4endentK
- ne or more Jmandatory, eisten+e-de4endentK
R'la,*%!*0 % H*/'( D'/(''
'elations$i4 o# degree ! are +alled binary
'elations$i4 o# degree 6 are +alled ternary and o# degree n are +alled n-ary.
In genral, an n-ary relations$i4 is not e&i*alent to n binary relations$i4s.
E,*,y !', C%(('!0%&*/ ,% ,' ',*,y Ty0' CAR
CA'
'egistrationJ'Egistration0&mber, StateK, )e$i+leID, a3e, odel, earJColorK
DATABASE DESIGN ISSUES ?
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
7/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
Car1
JJABC 1!6, (EFASK, (?!, %ord &stang, +on*ertible, 1, Jred,bla+3KK
Car!
JJABC 1!6, 0E 'K, P8/!, 0issan 6""ZF, !-door, !""!, Jbl&eKK
JJ)S /!", (EFASK, (D/!, B&i+3 eSabre, 9-door, !""6, J>$ite,bl&eKK
.
@'a E,*,y Ty0'!
An entity t$at does not $a*e a 3ey attrib&te
A ea3 entity m&st 4arti+i4ate in an identi#ying relations$i4 ty4e >it$ an o>ner
or identi#ying entity ty4e.
A weak entity +an be identi#ied &ni&ely only by +onsidering t$e 4rimary 3ey
o# anot$er JownerK entity.
Eam4le;
>ner entity set and >ea3 entity set m&st 4arti+i4ate in a one-to-manyrelations$i4 set Jone o>ner, many >ea3 entitiesK.
ea3 entity set m&st $a*e total 4arti+i4ation in t$is identifying relations$i4
set.
Entities are identi#ied by t$e +ombination o#;
- A 4artial 3ey o# t$e >ea3 entity ty4e.- ($e 4arti+&lar entity t$ey are related to in t$e identi#ying entity ty4e.
Eam4le;
S&44ose t$at a DEPE0DE0( entity is identi#ied by t$e de4endents #irstname and birt$date, and t$e s4e+i#i+ EPEE t$at t$e de4endent is related to.
DEPE0DE0( is a >ea3 entity ty4e >it$ EPEE as its identi#ying entity ty4e
*ia t$e identi#ying relations$i4 ty4e DEPE0DE0(%
DATABASE DESIGN ISSUES
lot
name
agepname
DependentsEmployees
ssn
Policy
cost
/
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
8/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
A !*)0l' ER &*a/(a)
K'y C%!,(a*,!
Ea)0l'" C%!*&'( @%(!I" * ,' ab%;' !*)0l' ER &*a/(a)"
A ')0l%y'' .a %( * )ay &'0a(,)',! a&
a &'0, .a a;' )ay ')0l%y''!3
Ea. &'0, a! a, )%!, %' )aa/'(< a..%(&*/ ,% ,' key constraint %
$aa/'!3
DATABASE DESIGN ISSUES
lot
dname
budgetdid
sincename
Works_In DepartmentsEmployees
ssn
Many-to-Many1-to-1 1-to Many Many-to-1
dname
did
since
ManagesEmployeesDepartmentsR";1R";n
budget
8
lot
name
ssn
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
9/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
N%,a,*%! %( ER D*a/(a)!
4(%bl') *, ER N%,a,*%($e Entity-'ealtions$i4 model in its original #orm did not s&44ort t$e
s4e+iali2ation T generali2ation abstra+tions.
DATABASE DESIGN ISSUES
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
10/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
DATABASE DESIGN ISSUES 1"
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
11/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
DATABASE DESIGN ISSUES 11
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
12/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
DATABASE DESIGN ISSUES 1!
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
13/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
DATABASE DESIGN ISSUES 16
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
14/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
T%0*. 2" N%()al*+a,*%
Why Normalization?
R'&&a, I%()a,*% * T0l'! a& U0&a,' A%)al*'!
iing attrib&tes o# m<i4le entities may +a&se 4roblems
In#ormation is stored red&ndantly >asting storage
Problems >it$ &4date anomalies
Insertion anomalies
Deletion anomalies
odi#i+ation anomalies
Example of an update Anomaly
Consider t$e relation;EPP'= JEm4M, Pro7M, Ename, Pname, 0o$o&rsK
Update Anomaly; C$aing t$e name o# t$e 4ro7e+t n&mber #rom Billing to
C&stomer A++o&nting may +a&se t$is &4date to be made #or all 1"" em4loyees
>or3ing on 4ro7e+t P1.
Insert Anomaly:Cannot insert a 4ro7e+t &nless an em4loyee is assigned to.
In*ersely +annot insert an em4loyee &nless $eTs$e is assigned to a 4ro7e+t.
Delete Anomaly; $en a 4ro7e+t is deleted, it >ill res< in deleting all em4loyees
>$o >or3 on t$at 4ro7e+t. Alternati*ely, i# an em4loyee is an sole em4loyee on a
4ro7e+t, deleting t$at em4loyee >o&ld res< in deleting t$e +orres4onding 4ro7e+t.
4(a.,*.al U!' % N%()al F%()! N%()al*+a,*%is +arried o&t in 4ra+ti+e so t$at t$e res<ing designs are o#
$ig$ &ality and meet t$e desirable 4ro4erties
($e 4ra+ti+al &tility o# t$ese normal #orms be+omes &estionable >$en t$e
+onstraints on >$i+$ t$ey are based are a(& ,% &'(!,a&or to &','.,
($e database designers need notnormali2e to t$e $ig$est 4ossible normal
#orm. J&s&ally &4 to 60%, BC0% or 90%K
D'%()al*+a,*%" t$e 4ro+ess o# storing t$e 7oin o# $ig$er normal #orm
relations as a base relationU>$i+$ is in a lo>er normal #orm
1st introd&+ed by Codd in 1/!
Database normali2ation relates to t$e le*el o# red&ndan+y in a relational
databases str&+t&re.
DATABASE DESIGN ISSUES 19
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
15/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
($e 3ey idea is to red&+e t$e +$an+e o# $a*ing m<i4le di##erent *ersions o#
t$e same data, li3e an address, by storing all 4otentially d&4li+ated data in
di##erent tables and lin3ing to t$em instead o# &sing a +o4y.
N%()al*+a,*% D'**,*%@0ormali2ation is t$e 4ro+ess o# de+om4osing &nsatis#a+tory relation
s+$emas into smaller relation s+$emas >$i+$ +ontain desirable attrib&tes
JorK 4ro4erties
@ %or a good relation s+$ema design, a4art #rom normali2ation it s$o&ld $a*e
additional 4ro4erties li3e
ossless-7oin JorK 0on-additi*e 7oin 4ro4erty - It is more im4ortant +annot be
s+ari#ied
De4enden+y 4reser*ation 4ro4erty - It is less im4ortant +an be s+ari#ied
Functional Dependencies
%&n+tional De4enden+ies J%DsK are &sed to s4e+i#y #ormal meas&res o# a goodness
o# t$e relational design.
%Ds and eys are &sed to de#ine normal #orms #or relations
%Ds are +onstraints t$at are deri*ed #rom t$e meaning#&l and interrelations$i4 o# t$e
data attrib&tes.
A set o# attrib&tes F #&n+tionally determines t$e set o# attrib&tes i# t$e *al&e o# F
determines a &ni&e *al&e o#
F $olds >$ene*er t>o t&4les $a*e t$e same *al&e #or F t$ey m&st $a*e t$e
same *al&e #or .
%or any t>o t&4les t1 and t! in any relation insran+e rJ ' K; i# t1RF H t!RF t$en
t1RHt!R.
F in ' s4e+i#ies a +onstraint on all relation instan+es r J ' K
ritten as F Q +an be dis4layed gra4$i+ally on a relation s+$ema as in %ig&res
J denoted by t$e arro> ; K
%Ds are deri*ed #rom t$e real->orld +onstraints on t$e attrib&tes.
DATABASE DESIGN ISSUES 1
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
16/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
N%()al F%() Ty0'!@ NF2; non-#irst normal #orm
@ 1NF; ' is in 10%. *all domain *al&es are atomi+.
@ 2NF; ' is in !. 0%.* ' is in 10% and e*ery non3ey attrib&te is #&lly
de4endent on t$e 3ey
@ NF; ' is in 60% *' is !0% and e*ery non3ey attrib&te is non-transiti*ely
de4endent on t$e 3ey
@ BCNF; ' is in BC0% *e*ery determinant is a +andidate 3ey
@ D','()*a,; an attrib&te on >$i+$ some ot$er attrib&te is #&lly #&n+tionally
de4endent.
Fl*/, R'la,*% Ea)0l'"
DATABASE DESIGN ISSUES
Overview o !"s NF2
1NF2NF3NF
BCNF
flt#
date
plane#
airline
from
to
miles
1?
l, &a,' 0la' a*(l*' (%) ,% )*l'!
FLT-INSTANCE
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
17/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
N%()al F%()! % Fl*/, Ea)0l'"
DATABASE DESIGN ISSUES
flt#
date
plane#
airline
from
to
miles
flt#
date
plane#flt#
airline
from
to
miles
from
to
miles
flt#
airline
from
to
flt#
date
plane#
1!"#
$!" %&'!"#
(!"#
1/
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
18/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
F*(!, N%()al F%()>1NF?
Eliminates 'e4eating Gro&4s. a3e a se4arate table #or ea+$ set o# related
attrib&tes, and gi*e ea+$ table a 4rimary 3ey. Based on t$e +on+e4t o# m<i*al&ed +om4osite attrib&tes.
($e domains o# all attrib&tes o# a relation s+$ema ' are atomi+, >$i+$ is i#
elements o# t$e domain are +onsidered to be indi*isible &nits.
@ D*!all%! ('la,*% !.')a! ,% a;' )l,*;al'& = .%)0%!*,' a,,(*b,'!
Al!% '!,'& ('la,*%! a,,(*b,'! %!' ;al'! %( a *&*;*&al ,0l' a('
%-a,%)*.3
T' &%)a*! % all a,,(*b,'! % a ('la,*% !.')a R a(' a,%)*.< *. *! *
'l')',! % ,' &%)a* a(' .%!*&'('& ,% b' *&*;*!*bl' *,!3
A ('la,*%al !.')a R *! * *(!, %()al %() * ,' &%)a*! % all a,,(*b,'!
% R a(' a,%)*.
0on-atomi+ *al&es +om4li+ate storage and en+o&rage red&ndant Jre4eatedK
storage o# data
E.g. Set o# a++o&nts stored >it$ ea+$ +&stomer, and set o# o>ners stored >it$
ea+$ a++o&nt
e ass&me all relations are in #irst normal #orm
Atomicity is actually a property of ho the elements of the domain are used!
E.g. Strings >o&ld normally be +onsidered indi*isible
S&44ose t$at st&dents are gi*en roll n&mbers >$i+$ are strings o# t$e #orm
CS0012 orEE1127
I# t$e #irst t>o +$ara+ters are etra+ted to #ind t$e de4artment, t$e domain o# roll
n&mbers is not atomi+.
Doing so is a bad idea; leads to en+oding o# in#ormation in a44li+ation 4rogram
rat$er t$an in t$e database.
DE4ART$ENT ('la,*% *, *!,a.'!
DNA$E DNO D$GRSSN DLOCS
'esear+$ ! !"""1"1 JDel$i, &mbai, ol+&ttaK
Administration 6 1"""111 Bangal&r&
5ead V&arters 1 """111 C$ennai
C%!*&'( ,% b' 0a(, % ,' &'**,*% % ('la,*%3
JEg1K
DCS is a m<i*al&ed attrib&te
DATABASE DESIGN ISSUES 18
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
19/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
Normalized "a#le $ in I NF ith redundancy
DNA$E DNO D$GRSSN DLOCS
'esear+$ ! !"""1"1 Del$i'esear+$ ! !"""1"1 &mbai
'esear+$ ! !"""1"1 ol+&tta
Administration 6 1"""111 Bangal&r&
5ead V&arters 1 """111 C$ennai
JEg!K
EPP'=
SS0 E0AE P'=EC(S
P0 5:'S
Normalized "a#le $ in I NF ith redundancy
E%&'&()*+
SS0 E0AE
E%&'&()*,
SS0 P0 5:'S
Note:It in*ol*es t$at remo*al o# red&ndant data #rom $ori2ontal ro>s.
e need to ens&re t$at t$ere is no d&4li+ation o# data in a gi*en ro>, and t$at e*ery
+ol&mn stores t$e least amo&nt o# in#ormation 4ossible.
@ S'.%& N%()al F%()>2NF?
Based on #&ll #&n+tional de4enden+y
Eliminate 'ed&ndant Data, i# an attrib&te de4ends on only 4art o# a m<i-
*al&ed 3ey, remo*e it to a se4arate table.
It &ses t$e +on+e4t o# %DJ%&n+tional De4enden+yK and 4rimary 3ey
F%&ll %D
Prime, non-4rime attrib&tes
DATABASE DESIGN ISSUES 1
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
20/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
A ('la,*% !.')a R *! * 2NF * ';'(y %0(*)' a,,(*b,' % R *! lly
.,*%ally &'0'&', % ,' 0(*)a(y 'y % R
I# ea+$ attrib&te A in a relation s+$ema ' meets one o# t$e #ollo>ing +riteria;
It m&st be in #irst normal #orm.
It is not 4artially de4endent on a +andidate 3ey.
E*ery non-3ey attrib&te is #&lly de4endent on ea+$ +andidate 3ey o# t$e
relation.
Se+ond 0ormal %orm Jor !0%K deals >it$ red&ndan+y o# data in *erti+al +ol&mns.
' +an be de+om4osed into !0% relations *ia t$e 4ro+ess o# !0% normali2ation.
Prime attrib&te attrib&te t$at is member o# t$e 4rimary 3ey 3.
%&ll %&n+tional De4enden+y A %D Z >$ere remo*al o# any attrib&te #rom means t$e %D does not $old any more.
Ea)0l'"
NSS0 P0 O 5:'S is a #&ll %D
$ere as SS0 5:'S P0 5:'S does not.
($e relation;EPP'=
SS0 E0AE P'=EC(SP0 5:'S
is normali2ed into !0% as;
SS0E0AE
N SS0, P0 O
5:'S
NSS0, E0AE O 5:'S
DATABASE DESIGN ISSUES !"
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
21/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
T*(& N%()al F%() >NF?
It eliminates +ol&mns not de4endent on 3ey. I# attrib&tes do not +ontrib&te to a
des+ri4tion o# t$e 3ey, remo*e t$em to a se4arate table.
A ('la,*% R *! * T*(& N%()al F%() >NF? * a& %ly * *, *!"
* S'.%& N%()al F%()3
E;'(y %-'y a,,(*b,' *! %-,(a!*,*;'ly &'0'&', % ,'
0(*)a(y 'y3
A a,,(*b,' C *! ,(a!*,*;'ly &'0'&', % a,,(*b,' A * ,'(' '*!,! a
a,,(*b,' B !. ,a, A B a& B C< ,' A C3
T(a!*,*;*,y F.,*%al D'0'&'.y a FD X ,a, .a b' &'(*;'& (%)
,% FD! X Y a& Y
Ea)0l'!"
EPDEP(E0AE SS0 BDA(E ADD'ESS D0 D0AE DG'SS0
SS0DG'SS0 is a (ransiti*e %D sin+e
SS0D0 and D0DG'SS0 $olds.
SS0D0AE is not a (ransiti*e %D sin+e t$ere is no set o# attrib&tes F >$ere
SS0F and FE0AE
A R'la,*% !.')a R *! * NF * *, *! * 2NF a& % %-0(*)' a,,(*b,' A *
R *! ,(a!*,*;'ly &'0'&', % ,' 0(*)a(y 'y.
' +an be de+om4osed into 60% relations *ia t$e 4ro+ess o# 60% normali2ation.
0ote; in F and Z >it$ F as t$e 4rimary 3ey, >e +onsider t$is a 4roblemonly i# is not a +andidate 3ey. $en is a +andidate 3ey, t$ere is no 4roblem
>it$ t$e transiti*e de4enden+y.
Eg. Consider EP JSS0, Em4M, SalaryK
5ere, SS0Em4MSalary and Em4M is a +andidate 3ey.
DATABASE DESIGN ISSUES !1
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
22/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
T' /''(al %()al %() &'**,*%- %( $l,*0l' 'yA 'elation s+$ema ' is in !0% i# e*ery non-4rime attrib&te A in ' is #&lly
#&n+tionally de4endent on e*ery 3ey o# '.
S&4er 3ey o# relation s+$ema ' a set o# attrib&tes S o# ' t$at +ontains a 3ey o# '.
A 'elation s+$ema ' is in 60% i# >$ene*er a %D F A $olds in ' t$en eit$er;
aK F is a s&4er 3ey o# ' or
bK A is a 4rime attrib&te o# '
E'(.*!'"
Consider a relation +alled s&44lier-4art >it$ t$e #ollo>ing data to be 4ro+essed;
NsM, stat&s, +ity, 4M, ty, +ostO
$ere,
sM -- s&44lier identi#i+ation n&mber Jt$is is t$e 4rimary 3eyK
stat&s -- stat&s +ode assigned to
+ity -- +ity name o# +ity >$ere s&44lier is lo+ated
4M -- 4art n&mber o# 4art s&44lied
ty -- &antity o# 4arts s&44lied to date
Con*ert t$e relation into 10%, !0%, 60%
1NF"
DATABASE DESIGN ISSUES !!
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
23/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
Eam4le; 1NF b, %, 2NF
#irst JsM, stat&s, +ity, 4M, tyK
%&n+tional De4enden+ies;JsM, 4artnoKty
JsMKstat&s
JsMK+ity
+itystat&s JS&44lierWs stat&s is determined by lo+ationK
Comments;
0on-3ey attrib&tes are not m&t&ally inde4endent J+itystat&sK.
2NF"%&n+tional De4enden+y on %irst 0ormal %orm;
sM UX +ity, stat&s Jt$is *iolated t$e Se+ond 0ormal %ormK
+ity UX stat&s
JsM,4MK UXty
0eed de+om4osition into t>o tables;
NF"%&n+tional De4enden+y o# t$e Se+ond 0ormal %orm;
SEC0D.sM UX SEC0D.stat&s J(ransiti*e de4enden+yK
SEC0D.sM UX SEC0D.+ity
SEC0D.+ity UX SEC0D.stat&s
DATABASE DESIGN ISSUES !6
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
24/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
SEC0D is +on*erted into S:PPIE'CI( and CI(S(A(:S
B%y.'-C%&& N%()al F%() >BCNF?
A relation ' is in Boy+e-Codd normal #orm JBC0%K i# and only i# e*ery determinant
is a +andidate 3ey
A relation s+$ema ' is in BC0% i# >$ene*er an %D F A $olds in ' t$en F is a
s&4er 3ey o# '.
Ea+$ 0ormal %orm is stri+tly stronger t$an t$e 4re*io&s one;
- E*ery !0% relation is in 10%
- E*ery 60% relation is in !0%
- E*ery BC0% relation is in 60%
($ere eists relations t$at are in 60% b&t not in BC0%.
($e goal is to $a*e ea+$ relation in BC0% J or 60%K
(o be 4re+ise, t$e de#inition o# 60% does not deal >it$ a relation t$at;
$as m<i4le +andidate 3eys, >$ere
t$ose +andidate 3eys are +om4osite, and
t$e +andidate 3eys o*erla4 Ji.e., $a*e at least one +ommon attrib&teK
Ea)0l'"
1?Consider t$e relation s+$ema ' >$i+$ $as attrib&tes
'HN+o&rseno, se+no,
o##eringde4t, +redit$o&rs, +o&rsele*el, instr+torssn, semester, year,
days$o&rs, roomno, noo#st&dentsO.
DATABASE DESIGN ISSUES !9
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
25/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
($e #ollo>ing %Ds $old on ';
+o&rseno No##eringde4t, +redit$o&rs, +o&rsele*elO
N+o&rseno, se+no, semester, yearO Ndays$o&rs, roomno, noo#st&dents,instr&+torssnO
Nroomno, days$o&rs, semester, yearONinstr&+torssn, +o&rseno, se+noO
2?A relation (EAC5 t$at is in 60% b&t not in BC0%
0arayanan Database ar3
Smit$ Database 0a*at$e
Smit$ 4erating System Ammar
Smit$ ($eory S+$&lmanalla+e Database ar3
alla+e 4erating System A$amed
ong Database mi+indsZet$ya Database 0a*at$e
A+$ie*ing t$e BC0% by de+om4osition;(>o %Ds eist in t$e relation (EAC5;
%D1; Nst&dent, +o&rse O instr&+tor
%D!; instr&+tor+o&rse
Nst&dent, +o&rseO is a +andidate 3ey #or t$is relation and t$at t$e
de4enden+ies s$o>n.
Sol&tion;
($ree 4ossible de+om4osition #or t$e relation (EAC5;iK N st&dent , instr&+tor O and N st&dent, Co&rse O
iiK N +o&rse, instr&+tor O and N +o&rse, st&dent O
iiiK N instr&+tor, +o&rseO and N instr&+tor, st&dentO
DATABASE DESIGN ISSUES
S(:DE0( C:'SE I0S(':C('
(EAC5
!
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
26/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
Candidate 3eys; NA,BO and NA,CO Determinants; NA,BO and NCO
A de+om4osition;
ossless, b&t not de4enden+y 4reser*ing
$l,*;al'& D'0'&'.*'! = F%(, NF
A single *al&es o# F determines many *al&es o# JJieK F m<idetermines KA )D is tri*ial )D i#
J1K is a s&bset o# F, or
J!K F H'
A )D >$i+$ does not satis#y J1K J!K is +alled nontri*ial )D
e &se m<i*al&ed de4enden+ies in t>o >ays;
1. (o test relations to determine >$et$er t$ey are legal &nder a gi*en set o##&n+tional and m<i*al&ed de4enden+ies
!. (o s4e+i#y +onstraints on t$e set o# legal relations. e s$all t$&s +on+erno&rsel*es only >it$ relations t$at satis#y a gi*en set o# #&n+tional and m<i*al&ed
de4enden+ies.
I# a relation r #ails to satis#y a gi*en m<i*al&ed de4enden+y, >e +an +onstr&+t a
relations rY t$at does
satis#y t$e m<i*al&ed de4enden+y by adding t&4les to r.
DATABASE DESIGN ISSUES
A
BC
A B C
R
C B
R1
A C
R2
!?
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
27/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
F%(, N%()al F%()>7NF?
Isolates inde4endent m<i4le relations$i4s. 0o table may +ontain t>o or more 1;n
Jone-to-manyK or n;m Jmany-to-manyK relations$i4s t$at are not dire+tly related.
A ('la,*% !.')a R *! * 7NF *, ('!0'., ,% a !', % .,*%al &'0'&'.*'!
F * %( ';'(y %,(*;*al $VD * F< X *! a !0'( 'y % R
Example:
(rans#orm t$e #ollo>ing BC0% table into a 90% oneJsK.
($e net table is in t$e BC0% #orm, +on*ert it to t$e 9t$ normal #orm.
la/a/'!*llE)0l%y''
%ren+$ele+tri+al=ones
Germanele+tri+al=ones
%ren+$me+$ani+al=ones
Germanme+$ani+al=ones
S4anis$4l&mbingSmit$
($e abo*e table does not +om4ly >it$ t$e 9t$ normal #orm, be+a&se it $as re4etitions li3e
t$is;
AF=ones
B=ones
So t$is data may be already in t$e table, >$i+$ means t$at its re4eated.
FB=ones
A=ones
(o trans#orm t$is into t$e 9t$ normal #orm J90%K >e m&st se4arate t$e original table into
t>o tables li3e t$is;
!*ll')0l%y''
ele+tri+al=ones
me+$ani+al=ones
4l&mbingSmit$
And
la/a/'')0l%y''
%ren+$=ones
DATABASE DESIGN ISSUES !/
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
28/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
German=ones
S4anis$Smit$
%* &'0'&'.*'! = F*, N%()al F%()
=DJ'1,'!, L, 'nK
E*ery legal relation instan+es r o# ' s$o&ld $a*e a lossless 7oin de+om4osition into
'1,'!, L, 'n
JieK
JJ'1XJrKK, J'!XJrKK, L , J'nXJrKKKHr
F*, N%()al F%()A relation s+$ema ' is in it$ res4e+t to %, a set o# #&n+tional,
m<i*al&ed and =oin de4enden+ies, i# #or e*ery nontri*ial =D in %[, e*ery 'i is a
s&4er 3ey o# '.
T%0*. " S'.(*,y
Da,aba!' !'.(*,y"
e+$anisms &sed to grant and re*o3e 4ri*ileges in relational database systems.e+$anisms -X Dis+retionary a++ess +ontrol
e+$anisms t$at en#or+e m<i4le le*els o# se+&rity -X mandatory a++ess +ontrol
S'.(*,y - 4rote+tion #rom mali+io&s attem4ts to steal or modi#y data.
Da,aba!' !y!,') l';'l
A&t$enti+ation and a&t$ori2ation me+$anisms to allo> s4e+i#i+ &sers a++ess only
to re&ired data
Ass&me se+&rity at net>or3, o4erating system, $&man, and
4$ysi+al le*els.
Database s4e+i#i+ iss&es;
ea+$ &ser may $a*e a&t$ority to read only 4art o# t$e data and to>rite only 4art o# t$e data.
:ser a&t$ority may +orres4ond to entire #iles or relations, b&t it may
also +orres4ond only to 4arts o# #iles or relations.
o+al a&tonomy s&ggests site-le*el a&t$ori2ation +ontrol in adistrib&ted database.
Global +ontrol s&ggests +entrali2ed +ontrol
O0'(a,*/ !y!,') l';'l
DATABASE DESIGN ISSUES !8
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
29/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
4erating system s&4er-&sers +an do anyt$ing t$ey >ant to t$e database\ Good
o4erating system le*el se+&rity is re&ired.
Prote+tion #rom in*alid logins
%ile-le*el a++ess 4rote+tion Jo#ten not *ery $el4#&l #or database
se+&rityKProte+tion #rom im4ro4er &se o# s&4er&ser a&t$ority.
Prote+tion #rom im4ro4er &se o# 4ri*ileged ma+$ine intr&+tions.
N',%( l';'l"m&st &se en+ry4tion to 4re*ent
Ea*esdro44ing J&na&t$ori2ed reading o# messagesK
as&erading J4retending to be an a&t$ori2ed &ser or sending messages
s&44osedly #rom a&t$ori2ed &sersK
Ea+$ site m&st ens&re t$at it +omm&ni+ate >it$ tr&sted sites Jnot
intr&dersK.in3s m&st be 4rote+ted #rom t$e#t or modi#i+ation o# messages
e+$anisms;
Identi#i+ation 4roto+ol J4ass>ord-basedK,
Cry4togra4$y.
4y!*.al l';'l
P$ysi+al a++ess to +om4&ters allo>s destr&+tion o# data by
intr&dersQ traditional lo+3-and-3ey se+&rity is needed
Com4&ters m&st also be 4rote+ted #rom #loods, #ire, et+.Prote+tion o# dis3s #rom t$e#t, eras&re, 4$ysi+al damage, et+.
Prote+tion o# net>or3 and terminal +ables #rom >ireta4s nonin*asi*e
ele+troni+ ea*esdro44ing, 4$ysi+al damage, et+.
Sol&tions;
'e4li+ated $ard>are;
mirrored dis3s, d&al b&sses, et+.
m<i4le a++ess 4at$s bet>een e*ery 4air o# de*ises
P$ysi+al se+&rity; lo+3s,4oli+e, et+.
So#t>are te+$ni&es to dete+t 4$ysi+al se+&rity brea+$es.
H)a l';'l
:sers m&st be s+reened to ens&re t$at an a&t$ori2ed &sers do
not gi*e a++ess to intr&ders
:sers s$o&ld be trained on 4ass>ord sele+tion and se+re+y
Prote+tion #rom stolen 4ass>ords, sabotage, et+.
DATABASE DESIGN ISSUES !
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
30/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
Primarily a management 4roblem;
%re&ent +$ange o# 4ass>ords
:se o# non-g&essable 4ass>ords
og all in*alid a++ess attem4ts
Data a&dits
Care#&l $iring 4ra+ti+es
Iss&es;
@ egal et$i+al iss&es
@ Poli+y iss&es
@ System related iss&es@ <i4le se+&rity le*els - se+ret, to4 se+ret, +on#idential &n+lassi#ied
Database se+&rity and a&t$ori2ation s&bsystem res4onsible #or ens&ring t$e
se+&rity o# 4ortions o# a database against &na&t$ori2ed a++ess.
I,(%&.,*% ,% Da,aba!' S'.(*,y I!!'!
(y4es o# Se+&rity
Database Se+&rity and t$e DBA
A++ess Prote+tion, :ser A++o&nts, and Database A&ditsD*!.(',*%a(y A..'!! C%,(%l Ba!'& % G(a,*/ a& R';%*/ 4(*;*l'/'!
(y4es o# Dis+retionary Pri*ileges
S4e+i#ying Pri*ileges :sing )ie>s
'e*o3ing Pri*ileges
Pro4ogation o# Pri*ileges :sing t$e G'A0( P(I0
An Eam4le
S4e+i#ying imits on Pro4agation o# Pri*ileges
$a&a,%(y A..'!! C%,(%l a& R%l'-Ba!'& A..'!! C%,(%l %( $l,*l';'l
S'.(*,y
Com4aring Dis+retionary A++ess Control and andatory A++ess Control
'ole-Based A++ess Control
A++ess Control Poli+ies #or E-Commer+e and t$e eb
Ty0'! % !'.(*,y )'.a*!)!"Dis+retionary se+&rity me+$anisms
andatory se+&rity me+$anisms
Statisti+al database se+&rity
Data en+ry4tion
Da,aba!' !'.(*,y = DBA:DBA res4onsible #or o*erall se+&rity o# t$e database system
Pri*ileged a++o&nt system a++o&nt
A+tions 4er#ormed by DBA;
DATABASE DESIGN ISSUES 6"
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
31/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
A++o&nt +reation
Pri*ilege granting
Pri*ilege re*o+ation
Se+&rity le*el assignment
Database log - a&dit trail
D*!.(',*%a(y A..'!! C%,(%l"
@ ! le*els o# assigning 4ri*ileges;
Account level
Relation level@ S4e+i#ying A&t$ori2ation by &sing )ie>s
@ 'e*o3ing Pri*ileges
@ Pro4agation o# Pri*ileges and t$e G'A0( P(I0
G'A0( SEEC( 0 EPEE ( A
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
32/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
5as entries o# t$e a44ro4riate data ty4e
'e#erential Integrity
Con+erned >it$ relations$i4s bet>een tables in t$e database
i.e. t$at t$e data in 1 table does not +ontradi+t t$e data in anot$er
e.g. e*ery %'EIG0 E *al&e in a table m&st $a*e a mat+$ing P'IA'
E *al&e in t$e +orres4onding tableData )alidation
Database anagement System JDBSK 4ro*ides #eat&res to $el4 ens&re data
integrity
:s&ally im4lemented &sing Database Constraints
S4e+i#ied in data di+tionary table de#inition
:s&ally s4e+i#ied on +reation o# table
ay be alteredTaddedTdro44ed later
Constraints
Col&mn Constraints
e.g.0ot 0&ll
S4e+i#ies t$at >$en a ne> ro> is inserted into table
($is +ol&mn m&st not +ontain only n&ll *al&es
De#a<
Allo>s a de#a< *al&e to be s4e+i#ied
Any time a ro> >it$ a n&ll *al&e #or t$is +ol&mn is entered t$e de#a<
*al&e is insertedConstraints
(able Constraints
e.g.Primary ey s4e+i#ies t$at >$en a ne> ro> is inserted t$e *al&e o# t$is +ol&mn
m&st be
0( 0: :0IV:E
DBS +reates an I0DEF on 4rimary 3ey +ol&mns
Constraints
(able Constraints
%oreign ey s4e+i#ies t$at >$en a ne> ro> is inserted t$e *al&e o# t$is +ol&mn
:S( mat+$)A:E o# t$e +orres4onding P'IA' E in t$e master table
0o +orres4onding master table entry
'o> not inserted
Error message
Creating (ables
ea+$ +ol&mn $as a +ol&mn-ty4e indi+ating
t$e si2e o# t$e +ol&mn and
t$e dataty4e o# *al&es t$at are a++e4table
DATABASE DESIGN ISSUES 6!
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
33/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
initially >e >ill &se data ty4es
)A'C5A'! #or Al4$an&meri+
DA(E #or dates and
0:BE' #or n&meri+
Creating (ables
e.g. ($e +&stomer table +o&ld be de#ined asC('a,' Tabl' C!,%)'( >
C!,%)'(N% Va(.a(2>5? NOT NULL8#? NOT NULLill
ta3e it #rom one +onsistent state to anot$er.
($e +onsisten+y 4ro4erty does not say $o> t$e DBS s$o&ld $andle an
in+onsisten+y ot$er t$an ens&re t$e database is +lean at t$e end o# t$e transa+tion. I#,
#or some reason, a transa+tion is ee+&ted t$at *iolates t$e databases +onsisten+y
r&les, t$e entire transa+tion +o&ld be rolled ba+3 to t$e 4re-transa+tional state - or it
>o&ld be e&ally *alid #or t$e DBS to ta3e some 4at+$-&4 a+tion to get t$edatabase in a +onsistent state.
($&s, i# t$e database s+$ema says t$at a 4arti+&lar #ield is #or $olding integern&mbers, t$e DBS +o&ld de+ide to re7e+t attem4ts to 4&t #ra+tional *al&es t$ere, or
it +o&ld ro&nd t$e s&44lied *al&es to t$e nearest >$ole n&mber; bot$ o4tions
maintain +onsisten+y.
DATABASE DESIGN ISSUES 66
http://en.wikipedia.org/wiki/Consistency_(database_systems)http://en.wikipedia.org/wiki/Database_schemahttp://en.wikipedia.org/wiki/Consistency_(database_systems)http://en.wikipedia.org/wiki/Database_schema7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
34/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
($e +onsisten+y r&le a44lies only to integrity r&les t$at are >it$in its s+o4e. ($&s, i#
a DBS allo>s #ields o# a re+ord to a+t as re#eren+es to anot$er re+ord, t$en
+onsisten+y im4lies t$e DBS m&st en#or+e re#erential integrity; by t$e time any
transa+tion ends, ea+$ and e*ery re#eren+e in t$e database m&st be *alid. I# a
transa+tion +onsisted o# an attem4t to delete a re+ord re#eren+ed by anot$er, ea+$ o#
t$e #ollo>ing me+$anisms >o&ld maintain +onsisten+y;
abort t$e transa+tion, rolling ba+3 to t$e +onsistent, 4rior stateQ
delete all re+ords t$at re#eren+e t$e deleted re+ord Jt$is is 3no>n as cascade
deleteKQ or,
n&lli#y t$e rele*ant #ields in all re+ords t$at 4oint to t$e deleted re+ord.
($ese are eam4les o# 4ro4agation +onstraintsQ some database systems allo> t$e
database designer to s4e+i#y >$i+$ o4tion to +$oose >$en setting &4 t$e s+$ema #ora database.
A44li+ation de*elo4ers are res4onsible #or ens&ring alication level +onsisten+y,
o*er and abo*e t$at o##ered by t$e DBS. ($&s, i# a &ser >it$dra>s #&nds #rom an
a++o&nt and t$e ne> balan+e is lo>er t$an t$e a++o&ntWs minim&m balan+e t$res$old,
as #ar as t$e DBS is +on+erned, t$e database is in a +onsistent state e*en t$o&g$
t$is r&le J&n3no>n to t$e DBSK $as been *iolated.
T%0*. 8" Da,aba!' T*/
$en is t&ning ne+essary] nly i# yo& #eel t$at a44li+ation is not r&nning #ast eno&g$
$at is to be t&ned]
ra+le database
A44li+ation
4erating system
0et>or3
T*/ G%al!
(o o4timi2e t$e 4er#orman+e o# database
(o ma3e database a*ailable to &sers >it$o&t ma3ing t$em >ait #or reso&r+es (o 4er#orm maintenan+e o4erations >it$o&t interr&4ting &sers
T*/ 4a(a)','(!
'es4onse time
Database a*ailability
Database $it 4er+entages
emory &tili2ation
DATABASE DESIGN ISSUES 69
http://en.wikipedia.org/wiki/Referential_integrityhttp://en.wikipedia.org/wiki/Propagation_constrainthttp://en.wikipedia.org/wiki/Referential_integrityhttp://en.wikipedia.org/wiki/Propagation_constraint7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
35/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
T*/ S,'0!
aK (&ne t$e design
bK (&ne t$e a44li+ation
+K (&ne memorydK (&ne I
eK (&ne +ontention
#K (&ne o4erating system
T*/ C%!*&'(a,*%!
Di##erent #or
(P databases
DSS databases
5ybrid databases &r database
5ybrid database
Data entry and 'e4ort generation done sim<aneo&sly
4'(%()a.' T*/
Ad7&sting *ario&s 4arameters and design +$oi+es to im4ro*e system 4er#orman+e #or
a s4e+i#i+ a44li+ation.
(&ning is best done by
identi#ying bottlene+3s, and
eliminating t$em.Can t&ne a database system at 6 le*els;
Ha(&a('-- e.g., add dis3s to s4eed &4 IT, add memory to in+rease b#er $its,
mo*e to a #aster 4ro+essor.Da,aba!' !y!,') 0a(a)','(! -- e.g., set b#er si2e to a*oid 4aging o# b#er,
set +$e+34ointing inter*als to limit log si2e. System may $a*e a&tomati+
t&ning.
H*/'( l';'l &a,aba!' &'!*/, s&+$ as t$e s+$ema, indi+es and transa+tionsB%,,l''.!
Per#orman+e o# most systems Jat least be#ore t$ey are t&nedK &s&ally limited by
4er#orman+e o# one or a #e> +om4onents; t$ese are +alled bottlene+3sE.g. 8"^ o# t$e +ode may ta3e &4 !"^ o# time and !"^ o# +ode ta3es &4 8"^
o# time
ort$ s4ending most time on !"^ o# +ode t$at ta3e 8"^ o# timeBottlene+3s may be in $ard>are Je.g. dis3s are *ery b&sy, CP: is idleK, or in
so#t>are
'emo*ing one bottlene+3 o#ten e4oses anot$er
De-bottlene+3ing +onsists o# re4eatedly #inding bottlene+3s, and remo*ing t$em
($is is a $e&risti+
DATABASE DESIGN ISSUES 6
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
36/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
I&',*y*/ B%,,l''.!
(ransa+tions re&est a se&en+e o# ser*i+es
e.g. CP:, Dis3 IT, lo+3s
it$ +on+&rrent transa+tions, transa+tions may $a*e to >ait #or a re&ested ser*i+e
>$ile ot$er transa+tions are being ser*ed
Can model database as a ''*/ !y!,')>it$ a &e&e #or ea+$ ser*i+etransa+tions re4eatedly do t$e #ollo>ing
re&est a ser*i+e, >ait in &e&e #or t$e ser*i+e, and get ser*i+ed
Bottlene+3s in a database system ty4i+ally s$o> &4 as *ery $ig$ &tili2ations Jand
+orres4ondingly, *ery long &e&esK o# a 4arti+&lar ser*i+e
E.g. dis3 *s CP: &tili2ation
1""^ &tili2ation leads to *ery long >aiting time;
'&le o# t$&mb; design system #or abo&t /"^ &tili2ation at 4ea3 load
&tili2ation o*er "^ s$o&ld be a*oided
:''! I A Da,aba!' Sy!,')
Tabl' 4a(a)','(!
(&ning o# $ard>are
(&ning o# s+$ema(&ning o# indi+es
(&ning o# materiali2ed *ie>s
(&ning o# transa+tions
T*/ % Ha(&a('
E*en >ell-t&ned transa+tions ty4i+ally re&ire a #e> IT o4erations(y4i+al dis3 s&44orts abo&t 1"" random IT o4erations 4er se+ond
S&44ose ea+$ transa+tion re&ires 7&st ! random IT o4erations. ($en to s&44ort
ntransa+tions 4er se+ond, >e need to stri4e data a+ross nT
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
37/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
s3e>K
0&mber o# IT o4erations 4er transa+tion +an be red&+ed by 3ee4ing more data in
memory
I# all data is in memory, IT needed only #or >rites
ee4ing #re&ently &sed data in memory red&+es dis3 a++esses, red&+ing n&mber
o# dis3s re&ired, b&t $as a memory +ost
Ha(&a(' T*/" F*;'-$*,' Rl'
V&estion; >$i+$ data to 3ee4 in memory;
I# a 4age is a++essed ntimes 4er se+ond, 3ee4ing it in memory sa*es
n _ 4ri+e-4er-dis3-dri*e
a++esses-4er-se+ond-4er-dis3
Cost o# 3ee4ing 4age in memory
4ri+e-4er-B-o#-memory
ages-4er-B-o#-memory
Brea3-e*en 4oint; *al&e o# n#or >$i+$ abo*e +osts are e&alI# a++esses are more t$en sa*ing is greater t$an +ost
Sol*ing abo*e e&ation >it$ +&rrent dis3 and memory 4ri+es leads to;
5-)*,' (l'"* a 0a/' ,a, *! (a&%)ly a..'!!'& *! !'& )%('
('',ly ,a %.' * 5 )*,'! *, !%l& b' '0, * )')%(y
Jby b&ying s#i+ient memory\K
Ha(&a(' T*/" O'-$*,' Rl'
%or se&entially a++essed data, more 4ages +an be read 4er se+ond. Ass&mingse&ential reads o# 1B o# data at a time;
1-)*,' (l'; !'',*ally a..'!!'& &a,a ,a, *! a..'!!'&
%.' %( )%(' * a )*,' !%l& b' '0, * )')%(yPri+es o# dis3 and memory $a*e +$anged greatly o*er t$e years, b&t t$e ratios $a*e
not +$anged m&+$
so r&les remain as < min&te and 1 min&te r&les, not 1 $o&r or 1 se+ond r&les\
Ha(&a(' T*/" C%*.' % RAID L';'l
(o &se 'AID 1 or 'AID rites
'AID < re&ires ! blo+3 reads and ! blo+3 >rites to >rite o&t one data blo+3I# an a44li+ation re&ires r reads and w>rites 4er se+ond
'AID 1 re&ires r ! 2w IT o4erations 4er se+ond
'AID < re&ires; r ! "w IT o4erations 4er se+ond
%or reasonably large r and >, t$is re&ires lots o# dis3s to $andle >or3load
'AID < may re&ire more dis3s t$an 'AID 1 to $andle load\
A44arent sa*ing o# n&mber o# dis3s by 'AID < Jby &sing 4arity, as o44osed tot$e mirroring done by 'AID 1K may be ill&sory\
($&mb r 'AID < is #ine >$en >rites are rare and data is *ery large, b&t 'AID 1
is 4re#erable ot$er>ise
DATABASE DESIGN ISSUES 6/
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
38/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
I# yo& need more dis3s to $andle IT load, 7&st mirror t$em sin+e dis3 +a4a+ities
t$ese days are enormo&s\
T*/ ,' Da,aba!' D'!*/
S.')a ,*/
)erti+ally 4artition relations to isolate t$e data t$at is a++essed most o#ten -- only#et+$ needed in#ormation.
E.g., s4lit accountinto t>o, Jaccount#number,branc$#nameK and Jaccount#
number, balanceK.
Bran+$-name need not be #et+$ed &nless re&ired
Im4ro*e 4er#orman+e by storing a &'%()al*+'& ('la,*%
E.g., store 7oin o# accountand deositorQ bran+$-name and balan+e
in#ormation is re4eated #or ea+$ $older o# an a++o&nt, b&t 7oin need not be
+om4&ted re4eatedly.
Pri+e 4aid; more s4a+e and more >or3 #or 4rogrammer to 3ee4 relation
+onsistent on &4datesbetter to &se materiali2ed *ie>s Jmore on t$is later..K
Cl&ster toget$er on t$e same dis3 4age re+ords t$at >o&ld
mat+$ in a #re&ently re&ired 7oin,
+om4&te 7oin *ery e##i+iently >$en re&ired.
I&' ,*/
Create a44ro4riate indi+es to s4eed &4 slo> &eriesT&4datesS4eed &4 slo> &4dates by remo*ing e+ess indi+es Jtradeo## bet>een &eries and
&4datesK
C$oose ty4e o# inde JB-treeT$as$K a44ro4riate #or most #re&ent ty4es o#&eries.
C$oose >$i+$ inde to ma3e +l&stered
Inde t&ning >i2ards loo3 at 4ast $istory o# &eries and &4dates Jt$e %(l%a&Kand re+ommend >$i+$ indi+es >o&ld be best #or t$e >or3load
$a,'(*al*+'& V*'!
ateriali2ed *ie>s +an $el4 s4eed &4 +ertain &eries
Parti+&larly aggregate &eries
*er$eadsS4a+e
(ime #or *ie> maintenan+e
Immediate *ie> maintenan+e;done as 4art o# &4date tn
time o*er$ead 4aid by &4date transa+tion
De#erred *ie> maintenan+e; done only >$en re&ired
&4date transa+tion is not a##e+ted, b&t system time is s4ent on *ie>maintenan+e
,*l 0&a,'&< ,' ;*' )ay b' %,-%-&a,'
Pre#erable to denormali2ed s+$ema sin+e *ie> maintenan+e
DATABASE DESIGN ISSUES 68
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
39/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
is systems res4onsibility, not 4rogrammers
A*oids in+onsisten+ies +a&sed by errors in &4date 4rograms
5o> to +$oose set o# materiali2ed *ie>s
5el4ing one transa+tion ty4e by introd&+ing a materiali2ed *ie> may $&rt ot$ers
C$oi+e o# materiali2ed *ie>s de4ends on +osts
:sers o#ten $a*e no idea o# a+t&al +ost o# o4erations*erall, man&al sele+tion o# materiali2ed *ie>s is tedio&s
Some database systems 4ro*ide tools to $el4 DBA +$oose *ie>s to materiali2e
ateriali2ed *ie> sele+tion >i2ards
T*/ % T(a!a.,*%!
Basi+ a44roa+$es to t&ning o# transa+tions
Im4ro*e set orientation
'ed&+e lo+3 +ontention
'e>riting o# &eries to im4ro*e 4er#orman+e >as im4ortant in t$e 4ast, b&t smart
o4timi2ers $a*e made t$is less im4ortantComm&ni+ation o*er$ead and &ery $andling o*er$eads signi#i+ant 4art o# +ost o#
ea+$ +all
C%)b*' )l,*0l' ')b'&&'& S:LODBCDBC '(*'! *,% a !*/l' !',-
%(*','& '(y
Set orientation -X #e>er +alls to database
E.g. t&ne 4rogram t$at +om4&tes total salary #or ea+$ de4artment &sing a
se4arate SV &ery by instead &sing a single &ery t$at +om4&tes totalsalaries #or all de4artment at on+e J&sing /(%0 by?
U!' !,%('& 0(%.'&('!; a*oids re-4arsing and re-o4timi2ation
o# &ery'ed&+ing lo+3 +ontention
ong transa+tions Jty4i+ally read-onlyK t$at eamine large 4arts o# a relation res<
in lo+3 +ontention >it$ &4date transa+tionsE.g. large &ery to +om4&te ban3 statisti+s and reg&lar ban3 transa+tions
(o red&+e +ontention
:se m<i-*ersion +on+&rren+y +ontrol
E.g. ra+le sna4s$ots >$i+$ s&44ort m<i-*ersion !P
:se degree-t>o +onsisten+y J+&rsor-stabilityK #or long transa+tions
Dra>ba+3; res< may be a44roimateong &4date transa+tions +a&se se*eral 4roblems
E$a&st lo+3 s4a+e
E$a&st log s4a+e
and also greatly in+rease re+o*ery time a#ter a +ras$, and may e*en e$a&st log
s4a+e d&ring re+o*ery i# re+o*ery algorit$m is badly designed\
:se )**-ba,.transa+tions to limit n&mber o# &4dates t$at a single transa+tion +an+arry o&t. E.g., i# a single large transa+tion &4dates e*ery re+ord o# a *ery large
relation, log may gro> too big.
_ S4lit large transa+tion into bat+$ o# `mini-transa+tions,WW ea+$ 4er#orming 4art
DATABASE DESIGN ISSUES 6
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
40/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
o# t$e &4dates
5old lo+3s a+ross transa+tions in a mini-bat+$ to ens&re seriali2ability
I# lo+3 table si2e is a 4roblem +an release lo+3s, b&t at t$e +ost o#
seriali2ability
_ In +ase o# #ail&re d&ring a mini-bat+$, m&st +om4lete its
remaining 4ortion on re+o*ery, to ens&re atomi+ity.
4'(%()a.' S*)la,*%
4'(%()a.' !*)la,*%&sing &e&ing model &se#&l to 4redi+t bottlene+3s as >ell
as t$e e##e+ts o# t&ning +$anges, e*en >it$o&t a++ess to real system
V&e&ing model as >e sa> earlier
odels a+ti*ities t$at go on in 4arallel
Sim&lation model is &ite detailed, b&t &s&ally omits some lo> le*el details
odel !'(;*.' ,*)', b&t disregard details o# ser*i+e
E.g. a44roimate dis3 read time by &sing an a*erage dis3 read time
E4eriments +an be r&n on model, and 4ro*ide an estimate o# meas&res s&+$ asa*erage t$ro&g$4&tTres4onse time
Parameters +an be t&ned in model and t$en re4li+ated in real system
E.g. n&mber o# dis3s, memory, algorit$ms, et+
T%0*. 6" O0,*)*+a,*% a& R'!'a(. I!!'!
U&'(!,a&*/ ,' :'(y O0,*)*+'(
A SV statement +an be ee+&ted in many di##erent >ays, s&+$ as #&ll table s+ans,inde s+ans, nested loo4s, and $as$ 7oins.
($e o&t4&t #rom t$e o4timi2er is a 4lan t$at des+ribes an o4tim&m met$od o#
ee+&tion.
($e &ery o4timi2er determines t$e most e##i+ient >ay to ee+&te a SV statement
a#ter +onsidering many #a+tors related to t$e ob7e+ts re#eren+ed and t$e +onditions
s4e+i#ied in t$e &ery.
($is determination is an im4ortant ste4 in t$e 4ro+essing o# any SV statement and+an greatly a##e+t ee+&tion time.
($e &ery o4timi2er determines >$i+$ ee+&tion 4lan is most e##i+ient by+onsidering a*ailable a++ess 4at$s and by #a+toring in in#ormation based on statisti+s
#or t$e s+$ema ob7e+ts Jtables or indeesK a++essed by t$e SV statement.
($e &ery o4timi2er also +onsiders $ints, >$i+$ are o4timi2ation s&ggestions 4la+ed
in a +omment in t$e statement.
DATABASE DESIGN ISSUES 9"
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
41/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
($e &ery o4timi2er 4er#orms t$e #ollo>ing ste4s;
1. ($e o4timi2er generates a set o# 4otential 4lans #or t$e SV statement based
on a*ailable a++ess 4at$s and $ints.
!. ($e o4timi2er estimates t$e +ost o# ea+$ 4lan based on statisti+s in t$e data
di+tionary #or t$e data distrib&tion and storage +$ara+teristi+s o# t$e tables,
indees, and 4artitions a++essed by t$e statement.
($e .%!,is an estimated *al&e 4ro4ortional to t$e e4e+ted reso&r+e &se
needed to ee+&te t$e statement >it$ a 4arti+&lar 4lan. ($e o4timi2er
+al+&lates t$e +ost o# a++ess 4at$s and 7oin orders based on t$e estimated+om4&ter reso&r+es, >$i+$ in+l&des IT, CP:, and memory.
Serial 4lans >it$ $ig$er +osts ta3e more time to ee+&te t$an t$ose >it$
smaller +osts. $en &sing a 4arallel 4lan, $o>e*er, reso&r+e &se is not
dire+tly related to ela4sed time.
6. ($e o4timi2er +om4ares t$e +osts o# t$e 4lans and +$ooses t$e one >it$ t$e
lo>est +ost.
V&ery o4timi2er +om4onents are ill&strated in
DATABASE DESIGN ISSUES 91
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
42/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
/omponents of the 0uery )ptimizer
($e &ery o4timi2er o4erations in+l&de;
(rans#orming V&eries
Estimating
Generating Plans
"ransformin. 0ueries
($e in4&t to t$e &ery trans#ormer is a 4arsed &ery, >$i+$ is re4resented by a set o#
&ery blo+3s. ($e &ery blo+3s are nested or interrelated to ea+$ ot$er. ($e #orm o#t$e &ery determines $o> t$e &ery blo+3s are interrelated to ea+$ ot$er. ($e main
ob7e+ti*e o# t$e &ery trans#ormer is to determine i# it is ad*antageo&s to +$ange t$e
#orm o# t$e &ery so t$at it enables generation o# a better &ery 4lan.
Estimatin.
($e end goal o# t$e estimator is to estimate t$e o*erall +ost o# a gi*en 4lan. I#
statisti+s are a*ailable, t$en t$e estimator &ses t$em to +om4&te t$e meas&res. ($e
statisti+s im4ro*e t$e degree o# a++&ra+y o# t$e meas&res.
($e estimator generates t$ree di##erent ty4es o# meas&res;
Sele+ti*ity
Cardinality
DATABASE DESIGN ISSUES 9!
http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/optimops.htm#37241http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/optimops.htm#37300http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/optimops.htm#37012http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/optimops.htm#37309http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/optimops.htm#37340http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/optimops.htm#37241http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/optimops.htm#37300http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/optimops.htm#37012http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/optimops.htm#37309http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/optimops.htm#373407/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
43/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
Cost
($ese meas&res are related to ea+$ ot$er, and one is deri*ed #rom anot$er.
1eneratin. &lans
($e main #&n+tion o# t$e 4lan generator is to try o&t di##erent 4ossible 4lans #or a
gi*en &ery and 4i+3 t$e one t$at $as t$e lo>est +ost. any di##erent 4lans are
4ossible be+a&se o# t$e *ario&s +ombinations o# di##erent a++ess 4at$s, 7oin met$ods,
and 7oin orders t$at +an be &sed to a++ess and 4ro+ess data in di##erent >ays and
4rod&+e t$e same res<.
R'!'a(. I!!'!%ulti20uery )ptimization
S+enario; <i4le related, b&t slig$tly di##erent &eries
Goal; Sa*e 4o>er and +omm&ni+ationC$allenge; Combining m<i4le &eries, #inding +ommon &ery 4arts
(>o a44roa+$es;
ateriali2ation
Pi4elining
3syntactic4 optimizer 5s syntactic optimizer
SV &ery tet is #irst semanti+ally o4timi2ed t$en 4assed to t$e +on*entional
Jsynta+ti+K o4timi2er.
Any ad*antage besto>ed by t$e semanti+ o4timi2er +an only be mani#ested by t$esynta+ti+ o4timi2er.
($e synta+ti+ o4timi2er >ill ty4i+ally loo3 to indees to en$an+e &ery e##i+ien+y.
T%0*. " D'!*/ % T')0%(al Da,aba!'!
@a, a(' ,')0%(al &a,aba!'!M
T')0%(al Da,aba!'!
(em4oral DBS manages time-re#eren+ed data, and times are asso+iated >it$database entities.
It en+om4asses database a44li+ations t$at re&ire some as4e+t o# time >$en
organi2ing t$eir in#ormation.
$%!, a00l*.a,*%! % &a,aba!' ,'.%l%/y a(' ,')0%(al * a,('"
%inan+ial a44s.; 4ort#olio management, a++o&nting ban3ing
'e+ord-3ee4ing a44s.; 4ersonnel, medi+al re+ord and in*entory management
DATABASE DESIGN ISSUES 96
http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/optimops.htm#37379http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/optimops.htm#373797/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
44/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
S+$ed&ling a44s.; airline, +ar, $otel reser*ations and 4ro7e+t management
S+ienti#i+ a44s.; >eat$er monitoring
De#inition;
A00l*.a,*%!"$ealt$-+are system ins&ran+e reser*ation systems, s+ienti#i+ databases
@ (ime 'e4resentation, (ime Dimensions
time- ordered se&en+e o# 0%*,! in some gran&larity t$at is determined bya44li+ation
Calendar- organi2es time into di##erent time &nits
JegK ?" se+s. -X 1 min et+.
N% T')0%(al
store only a single state o# t$e real >orld, &s&ally t$e most re+entstate
+lassi#ied as sna4s$ot databases
a44li+ation de*elo4ers and database designers need to +ode #or time
*arying data re&irements eg $istory tables, #ore+ast re4orts et+
T')0%(al
stores &4to t>o dimensions o# time i.e )AID JstatedK time and
('A0SAC(I0 JloggedK time
Classi#ied as $istori+al, rollba+3 or bi-tem4oral
0o need #or a44li+ation de*elo4ers or database designers to +ode #or
time *arying data re&irements i.e time is in$erently s&44orted
T')0%(al Da,a ,y0'!;
1K DA(E !K (IE 6K (IES(AP 9K I0(E')A
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
45/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
e +an &se t$ese t>o dimensions to disting&is$ bet>een di##erent #orms o#
tem4oral database
A rollba+3 database stores data >it$ res4e+t to transa+tion time e.g. ra+le1"g $as #las$ba+3 &ery
A $istori+al database stores data >it$ res4e+t to *alid time
A bi-tem4oral database stores data >it$ res4e+t to bot$ *alid time and
transa+tion time.
@a, *! ,*)' ;a(y*/ &a,aM
o& >ant a re4rint o# a +&stomerWs in*oi+e o# A&g&st 1!, 1.
$at >as t$e sto+3 *al&e o# t$e ra+le s$ares on =&ne 1as t$e lo>est sto+3 &antity #or e*ery 4rod&+t last year] 5o> m&+$
money >ill yo& sa*e, i# yo& 3ee4 t$e sto+3s at t$ose le*els]
$ere do yo& enter t$e ne> address o# t$is +&stomer as #rom t$e #irst o#
net mont$]
$at >ill yo&r 4ro#its be net mont$, gi*en t$e 4ri+e list and +ost 4ri+es by
t$en]
A& .%)b*a,*%! % ,' !*,a,*%! .a b' ;'(y .%)0l'
o& o##ered t$ese goods to t$e +&stomer on =an&ary 1" t$is year. $at
>ere t$e billing 4ri+es and >$at >as $is dis+o&nt le*el >$en yo& sent $im
t$is o##er] 5e $as not a++e4ted yet. Is it smart to o##er $im an a+t&ali2eddis+o&nt no>]
DATABASE DESIGN ISSUES 9$en >ere t$e 4oli+ies in e##e+tK
'eser*ation Systems Je.g. >$en is >$i+$ room in a $otel boo3edK
edi+al In#ormation anagement Systems Je.g. 4atient re+ordsK
De+ision S&44ort Systems Je.g. 4lanning #&t&re +ontigen+iesK
C' a44li+ations Jeg +&stomer $istory T #&t&reK
5' a44li+ations Je.g Date tra+3ed 4ositions in $ierar+$iesK
In #a+t, time *arying data $as AAS been in b&siness re&irements b&t
eisting te+$nology does not deal >it$ it elegantly\
E;', I%()a,*% V'(!! D(a,*% >%( S,a,'? I%()a,*%"
Point e*ents or #a+ts
single time 4oint
time series data
D&ration e*ents or #a+ts
time 4eriod Rstart-time, endtime
Val*& T*)' a& T(a!a.,*% T*)' D*)'!*%!"
Inter4retation o# e*ents a*ailable in tem4oral databases
*alid time
transa+tion time
*alid time database, transa+tion time databaseBitem4oral database
:ser-de#ined time
"
(ime dimensions
(ime, semanti+s 4rogram
a44li+ations
In+or4orating (ime in 'elational DatabasesVal*& T*)' R'la,*%!
Gran&larity Day, data ty4e
)alid Start (imeJ)S(K, )alid End (imeJ)E(K
(em4oral *ariableno>
DATABASE DESIGN ISSUES 9?
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
47/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
:4date o4erations in tem4oral relations;
+&rrent *ersion, old *ersion
4roa+ti*e &4date J&4dation be#ore im4lementationK
rea+ti*e &4date J&4dation a#ter im4lementationK
sim<aneo&s &4date
EPB(
SS0 E0AE D0 )S( )E( (S( (E(
In+or4orating (ime in 'elational Databases
T(a!a.,*% T*)' R'la,*%!
(ransa+tion Start (imeJ(S(K, (ransa+tion End (imeJ(E(K
(ransa+tion time relations
'ollba+3 database
B*,')0%(al T*)' R'la,*%!
)S(,)E(,(S(,(E(X
T*)' S'(*'! Da,a
Data *al&es re+orded a++ording to a s4e+i#i+ 4rede#ined se&en+e o# time 4oints.U!a/';
#inan+ial, sales e+onomi+s a44li+ations
(y4i+al &eries in*ol*e tem4oral aggregation(ime series management systems
I)0l')',a,*% A00(%a.'!
Se*eral im4lementation strategies are a*ailable
:se a date ty4e s&44lied in a non-tem4oral DBS and b&ild tem4oral
s&44ort into a44li+ations JtraditionalK
Im4lement an abstra+t data ty4e #or time Job7e+t orientedK
Pro*ide a 4rogram layer Ja4iK abo*e a non-tem4oral data model Jstrat&mK
Generalise a non-tem4oral data model into a tem4oral data modelJ(em4oral 0ormal %ormK
'e-design +ore database 3ernel J(em4oral DatabaseK
DATABASE DESIGN ISSUES 9/
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
48/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
T%0*. 9" S0a,*al Da,aba!'!
I,(%&.,*%
any a44li+ations in *ario&s #ields re&ire management o#geometric% geogra$icor satial data Jdata related to s4a+eK
A geogra4$i+ s4a+e; s&r#a+e o# t$e eart$
an-made s4a+e; layo&t o# )SI design
odel o# t$e $&man brain
6-D s4a+e re4resentation o# t$e +$ains o# 4rotein mole+&les
($e Common +$allenge;
Dealing >it$ large +olle+tions o# relati*ely sim4le geometri+ ob7e+ts; e.g.,
1"",""" 4olygons
S0a,*al Da,aba!'
What is a -D6%- ?
A SDBS is a so#t>are mod&le t$at
+an >or3 >it$ an &nderlying DBS
s&44orts s4atial data models, s4atial abstra+t data ty4es JAD(sK and a
&ery lang&age #rom >$i+$ t$ese AD(s are +allable
s&44orts s4atial indeing, e##i+ient algorit$ms #or 4ro+essing s4atial
o4erations, and domain s4e+i#i+ r&les #or &ery o4timi2ation
Eam4le; ra+le S4atial data +artridge, ES'I SDE +an >or3 >it$ ra+le 8i DBS
5as s4atial data ty4es Je.g. 4olygonK, o4erations Je.g. o*erla4K +allable
#rom SV6 &ery lang&age
5as s4atial indi+es, e.g. '-trees
A !0a,*al &a,aba!' !y!,')"
Is a database system J>it$ additional +a4abilities #or $andling s4atial dataK
##ers s4atial data ty4es JSD(sK in its data model and &ery lang&age
Str&+t&re in s4a+e; e.g., PI0(, I0E, 'EGI0
'elations$i4s among t$em; e.g., a interse+ts b
S&44orts SD( in its im4lementation
S4atial indeing; retrie*ing ob7e+ts in 4arti+&lar area >it$o&t s+anning t$e >$ole
s4a+e
E##i+ient algorit$m #or s4atial 7oins
Ea)0l'"
Ass&me !-D GIS a44li+ation, t>o basi+ t$ings need to be re4resented;
DATABASE DESIGN ISSUES 98
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
49/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
b7e+ts in s4a+e; +ities, #orests, or ri*ers
distin+t entities arranged in s4a+e, ea+$ o# >$i+$ $as its o>n geometri+ des+ri4tion
HXmodeling single ob7e+ts
S4a+e; des+ribe t$e s4a+e itsel# say somet$ing abo&t e*ery 4oint in s4a+e
HXmodeling s4atially related +olle+tions o# ob7e+ts
-D6%- Example
Consider a s4atial dataset >it$;
Co&nty bo&ndary Jdas$ed >$ite lineK
Cens&s blo+3 - name, area, 4o4&lation, bo&ndary Jdar3 lineK
ater bodies Jdar3 4olygonsK
Satellite Imagery Jgray s+ale 4ielsK
Storage in a SDBS table;
+reate table +ens&sblo+3s J
name string, area #loat,
4o4&lation n&mber,
bo&ndary 4olygon KQ
S0a,*al Da,aba!'!
Con+e4ts abo&t ob7e+ts in a m<idimensional s4a+e.n-dimensional s4a+e.
JegK ma4s
Poli+e *e$i+les, amb&lan+es
(e+$ni&es #or s4atial indeing;
1K R-,(''!
'e+tangle areas
ea# node
Internal nodes-Xre+tangles >$ose area +o*ers all t$e re+tangles in its s&btree
!K :a&,(''!
di*ides ea+$ s4a+e or s&bs4a+e into e&ally si2ed areas 4ro+eed >it$ t$e
s&bdi*isions o# ea+$ s&bs4a+e to identi#y t$e 4ositions o# *ario&s ob7e+ts.
-patial Data "ypes and "raditional Data#ases
(raditional relational DBS
S&44ort sim4le data ty4es, e.g. n&mber, strings, date
odeling S4atial data ty4es is tedio&s
Eam4le; modeling o# 4olygon &sing n&mbers
($ree ne> tables; 4olygon, edge, 4oints
DATABASE DESIGN ISSUES 9
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
50/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
@ 0ote; Polygon is a 4olyline >$ere last 4oint and #irst 4oint are
same
A sim4le &nit sa&re re4resented as 1? ro>s a+ross 6 tables
Sim4le s4atial o4erators, e.g. areaJK, re&ire 7oining tables
(edio&s and +om4&tationally ine##i+ient
V&estion. 0ame 4ost-relational database management systems >$i+$ #a+ilitate
modeling o# s4atial data ty4es, e.g. 4olygon
-patial Data "ypes and &ost2relational Data#ases
&ost#relational '()S
Suort user defined abstract data tyes
Satial data tyes *e.g. olygon+ can be added
C$oice of ost#relational '()S
,b-ect oriented *,,+ '()S
,b-ect relational *,R+ '()S A satial database is a collection of satial data tyes% oerators% indices%
rocessing strategies% etc. and can work wit$ many ost#relational '()S aswell as rogramming languages like ava% /isual (asic etc.
7o is a -D6%- different from a 1I-?
S is a software to visualie and analye satial data using satial analysis
functions suc$ as
Searc$ 3$ematic searc$% searc$ by region% *re#+classification
4ocation analysis (uffer% corridor% overlay
3errain analysis Sloe5asect% catc$ment% drainage network 6low analysis Connectivity% s$ortest at$
'istribution C$ange detection% roimity% nearest neig$bor
Satial analysis5Statistics &attern% centrality% autocorrelation% indices
of similarity% toology8 $ole descrition
)easurements 'istance% erimeter% s$ae% ad-acency% direction
S uses S'()S
to store% searc$% 9uery% s$are large satial data sets
SDB$S %.!'! %
E##i+ient storage, &erying, s$aring o# large s4atial datasets Pro*ides sim4ler set based &ery o4erations
Eam4le o4erations; sear+$ by region, o*erlay, nearest neig$bor,
distan+e, ad7a+en+y, 4erimeter et+.
:ses s4atial indi+es and &ery o4timi2ation to s4eed&4 &eries o*er
large s4atial datasets.
SDBS may be &sed by a44li+ations ot$er t$an GIS
Astronomy, Genomi+s, <imedia in#ormation systems, ...
DATABASE DESIGN ISSUES
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
51/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
ill one &se a GIS or a SDB to ans>er t$e #ollo>ing;
5o> many neig$boring +o&ntries does :SA $a*e]
$i+$ +o&ntry $as $ig$est n&mber o# neig$bors]
/omponents of a -D6%-
'e+all; a SDBS is a so#t>are mod&le t$at
+an >or3 >it$ an &nderlying DBS
s&44orts s4atial data models, s4atial AD(s and a &ery lang&age #rom
>$i+$ t$ese AD(s are +allable
s&44orts s4atial indeing, algorit$ms #or 4ro+essing s4atial o4erations,
and domain s4e+i#i+ r&les #or &ery o4timi2ation
Com4onents in+l&de
s4atial data model, &ery lang&age, &ery 4ro+essing, #ile organi2ation
and indi+es, &ery o4timi2ation, et+.
%ig&re 1.? s$o>s t$ese +om4onents e dis+&ss ea+$ +om4onent brie#ly in +$a4ter 1.? and in more detail
in later +$a4ters.
T('' Lay'( A(.*,'.,('
S4atial A44li+ations S4atial DB DBS
-patial "axonomy8 Data %odels
S4atial (aonomy; m<it&de o# des+ri4tions a*ailable to organi2e s4a+e.
(o4ology models $omeomor4$i+ relations$i4s, e.g. o*erla4
E&+lidean s4a+e models distan+e and dire+tion in a 4lane
Gra4$s models +onne+ti*ity, S$ortest-Pat$
S4atial data models
r&les to identi#y identi#iable ob7e+ts and 4ro4erties o# s4a+e
b7e+t model $el4 manage identi#iable t$ings, e.g. mo&ntains, +ities,
land-4ar+els et+.
%ield model $el4 manage +ontin&o&s and amor4$o&s 4$enomenon,
e.g. >etlands, satellite imagery, sno>#all et+.-patial 0uery 9an.ua.e
(y4es o# s4atial &eries;
1K 'ange &ery !K 0earest neig$bor &ery 6K S4atial =oins
@ S4atial &ery lang&age
@ S4atial data ty4es, e.g. 4oint, linestring, 4olygon, L
@ S4atial o4erations, e.g. o*erla4, distan+e, nearest neig$bor, L
DATABASE DESIGN ISSUES
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
52/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
@ Callable #rom a &ery lang&age Je.g. SV6K o# &nderlying DBS
SEEC( S.name
%' Senator S
5E'E S.distri+t.AreaJK X 6""
@ Standards
@ SV6 Ja.3.a. SV 1K is a standard #or &ery lang&ages@ GIS is a standard #or s4atial data ty4es and o4erators
@ Bot$ standards en7oy >ide s&44ort in ind&stry
(>o main iss&es;
1. Conne+ting t$e o4erations o# a s4atial algebra to t$e #a+ilities o# a DBS
&ery lang&age.
!. Pro*iding gra4$i+al 4resentation o# s4atial data Ji.e. res<s o# &eriesK, and
gra4$i+al in4&t o# SD( *al&es &sed in &eries.
F&a)',al !0a,*al al/'b(a %0'(a,*%!"
S0a,*al !'l'.,*%; ret&rning t$ose ob7e+ts satis#ying a s4atial 4redi+ate >it$ t$e
&ery ob7e+t
Eam4le; All big +ities no more t$an 6""ms #rom a&sanne
SEEC( +name %' +ities + 5E'E distJ+.+enter,
a&sanne.+enterK 6"" and +.4o4 X it2erland.,area and
distJr.ro&te, +.areaK
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
53/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
S+ale Sele+tion
S&barea #or &eries
<i-s+an V&ery
S4atial 7oin Eam4le
SEEC( S.name %' Senator S, B&siness B 5E'E S.dsitin+t.AreaJK X 6""A0D it$inJB.lo+ation, S.distin+tK0on-S4atial =oin Eam4le;
SEEC( S.name %' Senator S, B&siness B 5E'E S.so+.Se+ A0D S.gender
H%emale A0D it$inJB.lo+ation, S.distin+tK
DATABASE DESIGN ISSUES
0AE SEC-SEC GE0DE' DIS(I0C(JPG0K
B-0AE 0E' SC-SEC CA(I0JPI0(K
SE0A('
B:SI0ESS
=I0SPA(IA=I0
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
54/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
Sa)0l' :'!,*%!
T%0*. 1"
1K $at are t$e t>o >ays o# modeling a Database] J!K
!K $at are t$e ste4s in designing database] J!K
6K $at are entities] Des+ribe abo&t Entity set J!K
9K $at are attrib&tes] J!K
E' odel diagram #or t$e #ollo>ing 4roblem statement;($e 4roblem area is Com4any en*ironment.
aK Ea+$ em4loyee data s&+$ em4M, name, date-o#-birt$, address,
+ity, state, +o&ntry s$o&ld be stored.
bK Em4loyee m&st >or3 in 4arti+&lar de4artment.
+K Ea+$ de4artment in#ormation s&+$ de4tM, name, lo+ation
s$o&ld be stored.
T%0*. 2"
1K $at is 0ormali2ation] J!K
!K $y >e need to sele+t and a44ly 0ormali2ation] J!K6K $at are red&ndant data ] 5o> t$ey in#l&en+es di##erent anomalies and
e4lain t$em >it$ an eam4le. J8K
9K Com4are and +ontrast 0ormali2ation >it$ Denormali2ation. J!K
it$ an eam4le #or ea+$. J8K
/K ist and des+ribe t$e basi+ r&leJsK be$ind %irst 0ormal %ormJ10%K. E4lain
>it$ an eam4le.
DATABASE DESIGN ISSUES
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
55/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
8K ist and des+ribe t$e basi+ r&leJsK be$ind %irst 0ormal %ormJ10%K. E4lain
>it$ an eam4le.
K ist and des+ribe t$e basi+ r&leJsK be$ind Se+ond 0ormal %ormJ!0%K.
E4lain >it$ an eam4le.
1"Kist and des+ribe t$e basi+ r&leJsK be$ind %irst 0ormal %ormJ60%K. E4lain
>it$ an eam4le.11K ist and des+ribe t$e basi+ r&leJsK be$ind Boy+e-Codd 0ormal
%ormJBC0%K. E4lain >it$ an eam4le.
1!K ist and des+ribe t$e basi+ r&leJsK be$ind %o&rt$ 0ormal %ormJ90%K.
E4lain >it$ an eam4le.
16Kist and des+ribe t$e basi+ r&leJsK be$ind %i#t$ 0ormal %ormJit$ an eam4le.
19K All 60% relations need not be BC0% E4lain >it$ an eam4le. J!K
1it$ an eam4le. J!K
1?K $at are =oin de4enden+ies] E4lain >it$ an eam4le. J!K
1/K$at is 0ormali2ation] E4lain t$e *ario&s normali2ation te+$ni&es >it$s&itable eam4les. J1?K
18KGi*en t$e Com4arison bet>een BC0% and 60%. J8K
1K C$oose a 3ey and >rite t$e de4enden+ies #or t$e #ollo>ing Grades;
relation;G'ADESJSt&dentID, Co&rseM, SemesterM, GradeK
A!'("
ey is ;
St&dentID, Co&rseM, SemesterM,
De4enden+y is;
St&dentID, Co&rseM, SemesterM -X Grade
2#?C$oose a 3ey and >rite t$e de4enden+ies #or t$e I0EI(ES relation;
I0EI(ES JP0&mber, Item0&m, Part0&m, Des+ri4tion, Pri+e, VtyK
A!'("
ey +an be; P0&mber, Item0&mDe4enden+ies are;
P0&mber, Item0&m -X Part0&m, Des+ri4tion, Pri+e, Vty
Part0&m -X Des+ri4tion, Pri+e
21? $at normal #orm is t$e abo*e I0EI(ES relation in]
A!'(;
%irst o##, I0EI(ES +o&ld not be in BCNFbe+a&se; not all determinants are 3eys.
net; it +o&ld not be in NFbe+a&se t$ere is a transiti*e de4enden+y;
DATABASE DESIGN ISSUES
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
56/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
P0&mber, Item0&m -X Part0&m
and
Part0&m -X Des+ri4tion
($ere#ore, it m&st be in 2NF, >e +an +$e+3 t$is is tr&e be+a&se;
t$e 3ey o# P0&mber, Item0&m determines all o# t$e non-3ey attrib&tes $o>e*er,P0&mber by itsel# and Item0&m by itsel# +an not determine any ot$er attrib&tes.
22? $at normal #orm is t$e #ollo>ing relation in]
S('EI(EJ S:, PromotionID, )endor, Style, Pri+e K S:;% &romotion' #< /endor% Style% &rice
S:; #< /endor% Style
A!'(;
S('EI(E is in 1NFJnon-3ey attrib&te J*endorK is de4endent on only 4art o#
t$e 3ey.
2?0ormali2e t$e abo*e JV9K relation into t$e net $ig$er normal #orm.
A!'(;
S('EI(E JS:, PromotionID, Pri+eK
)E0D' I(E JS:, )endor, StyleK
27?C$oose a 3ey and >rite t$e de4enden+ies #or t$e #ollo>ing S%(A'E relationJass&me all o# t$e *endors 4rod&+ts $a*e t$e same >arrantyK.
S%(A'E JSo#t>are)endor, Prod&+t, 'elease, System'e, Pri+e, arrantyK
Software/endor% &roduct% Release #< SystemRe9% &rice% =arranty
A!'(;
3ey is; So#t>are)endor, Prod&+t, 'elease
Software/endor% &roduct% Release #< SystemRe9% &rice% =arranty
Software/endor #< =arranty.;. S%(A'E is in 10%
25?0ormali2e t$e abo*e So#t>are relation into 90%.
A!'(;
S%(A'E JSo#t>are)endor, Prod&+t, 'elease, System'e, Pri+eKA''A0( JSo#t>are)endor, arrantyK
28? $at normal #orm is t$e #ollo>ing relation in]
only 5,I +an a+t as t$e 3ey.
S(:%% J5, I, =, , , , 0, K 5, I -X =, ,
= -X
-X 0 -X
DATABASE DESIGN ISSUES
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
57/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
A!'(;
!0% J(ransiti*e de4enden+ies eistK
25?$at normal #orm t$e #ollo>ing relation in]
S(:%%! JD, , 0, (, C, ', K
D, -X 0, (, C, ', C, ' -X D
D -X 0
A!'(;10% JPartial ey De4enden+y eistK
!?K Is t$is relation in 10%] !0%] 60%]
Con*ert t$e relation to 60%.
I;%*.' ('la,*%
In*M date +&stID 0ame PartM Des+ Pri+e M:sed EtPri+e
(arate
(a (otal
19 1!T?6 9! ee A68 0&t ".6! 1" 6.!" ".1" 1.!! 16.9!
19 1!T?6 9! ee A9" Sa> 9.6 because- it +ontains deri*ed *al&es
EF( P'ICEJHPri+e F M &sedK
6.! H ".6! F 1"
- (a JHs&m o# Et 4ri+e o# same In*M F (a rateK1.!! H J6.! [ .""K F ".1"
- (otal JHs&m o# Et 4ri+e [ (aK
16.9! H J6.!" [ .""K [ 1.!!
(o get 10%, identi#y P and remo*e deri*ed attrib&tes
I; date +&stID 0ame 4a(, Des+ Pri+e M:sed (a rate
19 1!T?6 9! ee A68 0&t ".6! 1" ".1"
19 1!T?6 9! ee A9" Sa> 9.
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
58/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
- Partial %Ds >it$ 3ey attrib&tes.
- In*M -X Date, C&stID, 0ame, (a 'ate
- PartM -X Des+, Pri+e
R')%;' 4a(,*al FD!
1-UUUUUUUD1UUUUUUUUUUUU!UUU-D!UUU
I; date +&stID 0ame (a rate 4a(, Des+ Pri+e M:sed
19 1!T?6 9! ee ".1" A68 0&t ".6! 1"
19 1!T?6 9! ee ".1" A9" Sa> 9.
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
59/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
H
I; date +&stID (a rate
19 1!T?6 9! ".1"
1< 1T?9 99 ".1"
[.!,ID 0ame
9! ee
99 Pat
All relations in NF
I; 4a(, M:sed
19 A68 1"
19 A9" !1< A68 !"
4a(, Des+ Pri+e
A68 0&t ".6!
A9" Sa> 9.
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
60/61
CS9152 - DATABASE TECHNOLOGY UNIT IV
3ennel lo+ation
tri+3 ID
tri+3 name
tri+3 >$ere learned
s3ill le*el
Con*ert t$e relation #rom 00% to \0%, !0%, 60%.
T%0*. "
1. De#ine Database se+&rity. J!K
!. E4lain Database system le*el se+&rity. J!K
6. E4lain 4erating system le*el se+&rity. J!K
9. E4lain 0et>or3 le*el se+&rity. J!K
(&ning t$e Database Design is a+$ie*ed] E4lain. J8K
T%0*. 6"
1. E4lain V&ery 4timi2ation in detail. J8K!. 5o> do yo& &nderstand t$e V&ery 4timi2er] J!K
6. $at are t$e ste4s 4er#ormed in t$e &ery o4timi2er] Des+ribe. J8K
9. Ill&strate V&ery o4timi2er +om4onents >it$ a neat diagram. J8K
DATABASE DESIGN ISSUES ?"
7/26/2019 94797883-Cs9152-Dbt-Unit-IV-Notes
61/61
CS9152 - DATABASE TECHNOLOGY UNIT IV