s t o r a g e a n d f i l e o r g a n i z a t i o n s t o
play

S t o r a g e a n d F i l e O r g a n i z a t - PowerPoint PPT Presentation

S t o r a g e a n d F i l e O r g a n i z a t i o n S t o r a g e a n d F i l e O r g a n i z a t i o n F i l e O r g a n i z a t i o n F i l e O r g a n i z a t i o


  1. S t o r a g e a n d F i l e O r g a n i z a t i o n S t o r a g e a n d F i l e O r g a n i z a t i o n

  2. F i l e O r g a n i z a t i o n F i l e O r g a n i z a t i o n  B a s i c s  A d a t a b a s e i s a c o l l e c t i o n o f fj l e s ,  A fj l e i s a c o l l e c t i o n o f r e c o r d s  A r e c o r d ( t u p l e ) i s a c o l l e c t i o n o f fj e l d s ( a t t r i b u t e s )  F i l e s a r e s t o r e d o n D i s k s ( t h a t u s e b l o c k s t o r e a d a n d w r i t e )  T w o i m p o r t a n t i s s u e s : 1 . R e p r e s e n t a t i o n o f e a c h r e c o r d 2 . G r o u p i n g / O r d e r i n g o f r e c o r d s a n d s t o r a g e i n b l o c k s D a t a b a s e S y s t e m C o n c e p t s 1 1 . 2

  3. F i l e O r g a n i z a t i o n F i l e O r g a n i z a t i o n  G o a l a n d c o n s i d e r a t i o n s :  C o m p a c t n e s s  O v e r h e a d o f i n s e r t i o n / d e l e t i o n  R e t r i e v a l s p e e d  s o m e t i m e s w e p r e f e r t o b r i n g m o r e t u p l e s t h a n n e c e s s a r y i n t o M M a n d u s e C P U t o fj l t e r o u t t h e u n n e c e s s a r y o n e s ! D a t a b a s e S y s t e m C o n c e p t s 1 1 . 3

  4. R e c o r d R e p r e s e n t a t i o n R e c o r d R e p r e s e n t a t i o n  F i x e d - L e n g t h R e c o r d s  E x a m p l e A c c o u n t ( a c c - n u m b e r c h a r ( 1 0 ) , b r a n c h - n a m e c h a r ( 2 0 ) , b a l a n c e r e a l ) E a c h r e c o r d i s 3 8 b y t e s . S t o r e t h e m s e q u e n t i a l l y , o n e a f t e r t h e o t h e r R e c o r d 1 a t p o s i t i o n 0 , r e c o r d 2 a t p o s i t i o n 3 8 , r e c o r d 3 a t p o s i t i o n 7 6 e t c C o mp a c t n e s s ( 3 5 0 b y t e s ) D a t a b a s e S y s t e m C o n c e p t s 1 1 . 4

  5. F i x e d - L e n g t h R e c o r d s F i x e d - L e n g t h R e c o r d s  S i m p l e a p p r o a c h :   S t o r e r e c o r d i s t a r t i n g f r o m b y t e n ( i – 1 ) , w h e r e n i s t h e s i z e o f e a c h r e c o r d .  R e c o r d a c c e s s i s s i m p l e b u t r e c o r d s m a y c r o s s b l o c k s  M o d i fj c a t i o n : d o n o t a l l o w r e c o r d s t o c r o s s b l o c k b o u n d a r i e s  I n s e r t i o n o f r e c o r d i : A d d a t t h e e n d  D e l e t i o n o f r e c o r d i : T w o a l t e r n a t i v e s :  m o v e r e c o r d s :  i + 1 , . . . , n t o i , . . . , n – 1  M o v e r e c o r d n t o p o s i t i o n i  d o n o t m o v e r e c o r d s , b u t l i n k a l l f r e e r e c o r d s o n a f r e e l i s t D a t a b a s e S y s t e m C o n c e p t s 1 1 . 5

  6. F r e e L i s t s F r e e L i s t s  2 a p p r o a c h : F L R w i t h F r e e L i s t s n d  S t o r e t h e a d d r e s s o f t h e fj r s t d e l e t e d r e c o r d i n t h e fj l e h e a d e r .  U s e t h i s fj r s t r e c o r d t o s t o r e t h e a d d r e s s o f t h e s e c o n d d e l e t e d r e c o r d , a n d s o o n  C a n t h i n k o f t h e s e s t o r e d a d d r e s s e s a s p o i n t e r s s i n c e t h e y “ p o i n t ” t o t h e l o c a t i o n o f a r e c o r d . B e t t e r h a n d l i n g i n s / d e l L e s s c o m p a c t D a t a b a s e S y s t e m C o n c e p t s 1 1 . 6

  7. V a r i a b l e - L e n g t h R e c o r d s V a r i a b l e - L e n g t h R e c o r d s  3 a p p r o a c h : V a r i a b l e - l e n g t h r e c o r d s a r i s e i n d a t a b a s e s y s t e m s i n r d s e v e r a l w a y s :  S t o r a g e o f m u l t i p l e r e c o r d t y p e s i n a fj l e .  R e c o r d t y p e s t h a t a l l o w v a r i a b l e l e n g t h s f o r o n e o r m o r e fj e l d s .  R e c o r d t y p e s t h a t a l l o w r e p e a t i n g fj e l d s o r m u l t i v a l u e d a t t r i b u t e .  B y t e s t r i n g r e p r e s e n t a t i o n  A  ) t t a c h a n e n d - o f - r e c o r d ( c o n t r o l c h a r a c t e r t o t h e e n d o f e a c h r e c o r d  D i ffj c u l t y w i t h d e l e t i o n ( l e a v e s h o l e s )  D i ffj c u l t y w i t h g r o w t h 4    R 1 Field R 3 R 2 Count D a t a b a s e S y s t e m C o n c e p t s 1 1 . 7

  8. V a r i a b l e - L e n g t h R e c o r d s : S l o t t e d P a g e V a r i a b l e - L e n g t h R e c o r d s : S l o t t e d P a g e S t r u c t u r e S t r u c t u r e  4 a p p r o a c h V L R - S P t h  S l o t t e d p a g e h e a d e r c o n t a i n s :  n u m b e r o f r e c o r d e n t r i e s  e n d o f f r e e s p a c e i n t h e b l o c k  l o c a t i o n a n d s i z e o f e a c h r e c o r d  R e c o r d s s t o r e d a t t h e b o t t o m o f t h e p a g e  E x t e r n a l t u p l e p o i n t e r s p o i n t t o r e c o r d p t r s :  r e c - i d = < p a g e - i d , s l o t # > D a t a b a s e S y s t e m C o n c e p t s 1 1 . 8

  9. Rid = (i,N) Page i Rid = (i,2) Rid = (i,1) N 20 16 24 Pointer to start N . . . 2 1 # slots of free space SLOT DIRECTORY I n s e r t i o n : 1 ) U s e F r e e S p a c e P o i n t e r ( F P ) t o fj n d s p a c e a n d i n s e r t 2 ) F i n d a v a i l a b l e p t r i n t h e d i r e c t o r y ( o r c r e a t e a n e w o n e ) 3 ) a d j u s t F P a n d n u m b e r o f r e c o r d s D e l e t i o n ? D a t a b a s e S y s t e m C o n c e p t s 1 1 . 9

  10. V a r i a b l e - L e n g t h R e c o r d s ( C o n t . ) V a r i a b l e - L e n g t h R e c o r d s ( C o n t . )  F i x e d - l e n g t h r e p r e s e n t a t i o n :  r e s e r v e d s p a c e  p o i n t e r s  5 a p p r o a c h : F i x e d L i m i t R e c o r d s ( f o r V L R ) t h  R e s e r v e d s p a c e – c a n u s e fj x e d - l e n g t h r e c o r d s o f a k n o w n m a x i m u m l e n g t h ; u n u s e d s p a c e i n s h o r t e r r e c o r d s fj l l e d w i t h a n u l l o r e n d - o f - r e c o r d s y m b o l . D a t a b a s e S y s t e m C o n c e p t s 1 1 . 1 0

  11. P o i n t e r M e t h o d P o i n t e r M e t h o d  6 a p p r o a c h : P o i n t e r m e t h o d t h  P o i n t e r m e t h o d  A v a r i a b l e - l e n g t h r e c o r d i s r e p r e s e n t e d b y a l i s t o f fj x e d - l e n g t h r e c o r d s , c h a i n e d t o g e t h e r v i a p o i n t e r s .  C a n b e u s e d e v e n i f t h e m a x i m u m r e c o r d l e n g t h i s n o t k n o w n D a t a b a s e S y s t e m C o n c e p t s 1 1 . 1 1

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend