Complexty n the Database Allocaton Desgn Must tae relatonshp between fragments nto account Cost of ntegrty enforcements Constrants on response-tme, storage, and processng capablty Needed Informaton to do Allocaton Database nformaton: tuple sze, cardnalty of fragment Applcaton nformaton: #updates/#retreval a query performs on a fragment Ste Informaton: storage and processng capabltes and cost of processng a unt of wor Networ Informaton: communcaton cost to transfer a bloc of data between stes and 1
No models developed to date can handle all the constrants Current models smplfy assumptons and wor wth some specfc stuatons ormulaton of DAP DAP can be formulated as an optmzaton problem Mn(Total Cost) Subect to response tme constrant Storage constrant Processng load constrant DAP s NP-complete and several heurstcs have been proposed 2
Q q Constrants Q: Set of all queres S: Set of all stes STC : Storage cost of fragment at S Executon tme constrant Executon tme of q <= maxmum response tme of q for all q n Q Storage constrant STC storage capacty at ste S, S Processng constrant processng load of q at ste S S processng capacty of S, S S Cost Computaton Decson varable x defned as x 1f fragment s stored at ste S = 0 otherwse Total Cost = query processng cost + storage cost Solve the optmzaton constrant for x 3
Cost Model Total cost=query processng cost + storage cost TOC = q Q QPC + S S STC STC sze( = USC sze( ) = card( Unt cost of storng data at S ) x )* length( ) Query Processng Cost QPC = PC + TC Computaton cost of q Transfer cost of q PC = AC + IE + CC access cost of q + ntegrty enforcement cost of q + concurrency control cost of q 4
LPC : Cost of processng one unt of wor at ste S RR : Number of read accesses a query q maes to a fragment UR : #of update accesses a query q maes to a fragment Access cost of query q AC = ( u UR + r RR ) x S S Assume cost of an update same as cost of retreval 1 u = 0 1 r = 0 f query q f query q LPC 0 otherwse retreves from 0 otherwse updates Transmsson Cost Model Update cost: Need to perform updates to all replcas; no large results sent bac S S TCU = u * x * g g, o( ) TC = TCU + TCR o( ), + u * x * S S Cost of update message to all replcas that are nvolved n q Cost of confrmaton message bac to g : communcaton cost per message between S and S 5
Retreval Cost Model TCR = S S sel ( )* length( ) mn ( r * x * go( ), + r * x * * g, o( ) ) fsze Cost of sendng a query Cost of sendng the results bac Pc the least cost ste among all stes wth the replcas g : communcaton cost per message between S and S f sze : #Bytes n a message length( ): #bytes n fragment Sel ( ): Selectvty actor of q on Heurstc Approaches Allocaton of Horzontal ragments Allocaton of Vertcal ragments (Materal not n the textboo) 6
: : : fragment ndex ste ndex applcaton ndex ALLOCATION Notatons f : r : u : n = requency of applcaton at ste Number of retreval references of applcaton to fragment. Number of update references of applcaton to fragment. r + u (Number of accesses of applcaton to fragment ragment r Ste u Applcaton /w freq. f Allocaton of Horzontal ragments (1) No replcaton: Best t Strategy The number of local references of R at ste s B = R s allocated at ste * such that B * s maxmum. f n Advantage: A fragment s allocated to a ste that needs t most. Dsadvantage: It dsregards the mutual effect of placng a fragment at a gven ste f a related fragment s also at that ste. 7
Allocaton of Horzontal ragments (2) All benefcal stes approach (replcaton) B = f r c ' f ' u Cost of retreval references Cost of update references from other stes R s allocated at all stes * such that B * > 0. When all B s are negatve, a sngle copy of R s placed at the ste such that B * s maxmum. Allocaton of Horzontal ragments (3) Another Replcaton Approach: d β(d ) The degree of redundancy of R The relablty and avalablty beneft of havng R fully replcated. The relablty and avalablty beneft when the fragment has d copes. 1 d 3 ( ) = (1 ) (1) = 0, (2) = β d 2 β β, β (3) =, 2 4 The beneft of ntroducng a new copy of R at ste : B = f r c f ' Same as All Benefcal Stes approach ' u + β ( d ) Also taes nto account the beneft of replcaton 8
Allocaton of Horzontal ragments (4) All Benefcal Stes Approach: 1. Determne the set of all stes where the beneft of allocatng one copy of the fragment s hgher than the cost. 2. Allocate a copy of the fragment to each ste n the set. Alternatvely: 1. Determne the soluton of the non-replcated problem. 2. Progressvely ntroduce replcated copes startng from the most benefcal; the process s termnated when no addtonal replcaton s benefcal. How about Heurstcs for Vertcal Allocaton? 9
SUMMARY Desgn of a dstrbuted DB conssts of four phases: Phase 1: Global schema desgn (same as n centralzed DB desgn) Phase 2: ragmentaton Horzontal ragmentaton Prmary: Determne a complete and mnmal set of predcates Derved: Use semon Vertcal ragmentaton Identfy fragments such that many applcatons can be executed usng ust one fragment. Phase 3: Allocaton The prmary goal s to mnmze the number of remote accesses. Phase 4: Physcal schema desgn (same as n centralzed DB desgn). 10