Professional Documents
Culture Documents
CH 11
CH 11
Rev.Aug1,2008
DatabaseSystemConcepts,5thEd.
Silberschatz,KorthandSudarshan Seewww.dbbook.comforconditionsonreuse
Chapter11:StorageandFileStructure
s OverviewofPhysicalStorageMedia s MagneticDisks s RAID s TertiaryStorage s StorageAccess s FileOrganization s OrganizationofRecordsinFiles s DataDictionaryStorage
DatabaseSystemConcepts5thEdition
11.2
Silberschatz,KorthandSudarshan
ClassificationofPhysicalStorageMedia
s Speedwithwhichdatacanbeaccessed s Costperunitofdata s Reliability
q q
s Candifferentiatestorageinto:
q
DatabaseSystemConcepts5thEdition
11.3
Silberschatz,KorthandSudarshan
PhysicalStorageMedia
s Cachefastestandmostcostlyformofstorage;volatile;
managedbythecomputersystemhardware
q
s Mainmemory:
q
Volatilecontentsofmainmemoryareusuallylostifa powerfailureorsystemcrashoccurs.
11.4 Silberschatz,KorthandSudarshan
DatabaseSystemConcepts5thEdition
PhysicalStorageMedia(Cont.)
s Flashmemory
q q
q q
Readsareroughlyasfastasmainmemory Butwritesareslow(fewmicroseconds),eraseisslower
DatabaseSystemConcepts5thEdition
11.5
Silberschatz,KorthandSudarshan
PhysicalStorageMedia(Cont.)
s Flashmemory
q
NORFlash
NANDFlash
DatabaseSystemConcepts5thEdition
11.6
Silberschatz,KorthandSudarshan
PhysicalStorageMedia(Cont.)
s Magneticdisk
q q
diskfailurecandestroydata:israrebutdoeshappen
DatabaseSystemConcepts5thEdition
11.7
Silberschatz,KorthandSudarshan
PhysicalStorageMedia(Cont.)
s Opticalstorage
q
nonvolatile,dataisreadopticallyfromaspinningdiskusing alaser CDROM(640MB)andDVD(4.7to17GB)mostpopular forms Writeone,readmany(WORM)opticaldisksusedfor archivalstorage(CDR,DVDR,DVD+R) Multiplewriteversionsalsoavailable(CDRW,DVDRW, DVD+RW,andDVDRAM) Readsandwritesareslowerthanwithmagneticdisk Jukeboxsystems,withlargenumbersofremovabledisks,a fewdrives,andamechanismforautomaticloading/unloading ofdisksavailableforstoringlargevolumesofdata
q q
DatabaseSystemConcepts5thEdition
11.8
Silberschatz,KorthandSudarshan
PhysicalStorageMedia(Cont.)
s Tapestorage
q
q q q
hundredsofterabytes(1terabyte=109bytes)toevena petabyte(1petabyte=1012bytes)
DatabaseSystemConcepts5thEdition
11.9
Silberschatz,KorthandSudarshan
StorageHierarchy
DatabaseSystemConcepts5thEdition
11.10
Silberschatz,KorthandSudarshan
StorageHierarchy(Cont.)
s primarystorage:Fastestmediabutvolatile(cache,main
memory).
s secondarystorage:nextlevelinhierarchy,nonvolatile,
moderatelyfastaccesstime
q q
alsocalledonlinestorage E.g.flashmemory,magneticdisks
s tertiarystorage:lowestlevelinhierarchy,nonvolatile,slow
accesstime
q q
alsocalledofflinestorage E.g.magnetictape,opticalstorage
DatabaseSystemConcepts5thEdition
11.11
Silberschatz,KorthandSudarshan
MagneticHardDiskMechanism
NOTE:Diagramisschematic,andsimplifiesthestructureofactualdiskdrives
DatabaseSystemConcepts5thEdition 11.12 Silberschatz,KorthandSudarshan
MagneticDisks
s Readwritehead
q q
s Surfaceofplatterdividedintocirculartracks
q
s Eachtrackisdividedintosectors.
q q
s Toread/writeasector
q q
DatabaseSystemConcepts5thEdition
MagneticDisks(Cont.)
s Headdiskassemblies
q q
multiplediskplattersonasinglespindle(1to5usually) oneheadperplatter,mountedonacommonarm.
s Cylindericonsistsofithtrackofalltheplatters s Earliergenerationdisksweresusceptibletoheadcrashes
leadingtolossofalldataondisk
q
Currentgenerationdisksarelesssusceptibletosuch disastrousfailures,butindividualsectorsmaygetcorrupted
DatabaseSystemConcepts5thEdition
11.14
Silberschatz,KorthandSudarshan
DiskController
s Diskcontrollerinterfacesbetweenthecomputersystemand
thediskdrivehardware.
q q
Ifdataiscorrupted,withveryhighprobabilitystored checksumwontmatchrecomputedchecksum
Ensuressuccessfulwritingbyreadingbacksectorafterwriting it Performsremappingofbadsectors
DatabaseSystemConcepts5thEdition
11.15
Silberschatz,KorthandSudarshan
DiskSubsystem
s Diskinterfacestandardsfamilies
q q q
DatabaseSystemConcepts5thEdition
PerformanceMeasuresofDisks
s Accesstimethetimeittakesfromwhenareadorwriterequest
isissuedtowhendatatransferbegins.Consistsof:
q
Seektimetimeittakestorepositionthearmoverthecorrect track.
4to10millisecondsontypicaldisks
Rotationallatencytimeittakesforthesectortobeaccessed toappearunderthehead.
Averagelatencyis1/2oftheworstcaselatency. 4to11millisecondsontypicaldisks(5400to15000r.p.m.)
DatabaseSystemConcepts5thEdition
11.17
Silberschatz,KorthandSudarshan
PerformanceMeasures(Cont.)
s Datatransferratetherateatwhichdatacanberetrievedfrom
orstoredtothedisk.
q q
DatabaseSystemConcepts5thEdition
11.18
Silberschatz,KorthandSudarshan
PerformanceMeasures(Cont.)
s Meantimetofailure(MTTF)theaveragetimethediskis
expectedtoruncontinuouslywithoutanyfailure.
q q
MTTFdecreasesasdiskages
DatabaseSystemConcepts5thEdition
11.19
Silberschatz,KorthandSudarshan
OptimizationofDiskBlockAccess
s Blockacontiguoussequenceofsectorsfromasingletrack
q
s Diskarmschedulingalgorithmsorderpendingaccessesto
trackssothatdiskarmmovementisminimized
q
DatabaseSystemConcepts5thEdition
11.20
Silberschatz,KorthandSudarshan
OptimizationofDiskBlockAccess(Cont.)
s Fileorganizationoptimizeblockaccesstimebyorganizing
theblockstocorrespondtohowdatawillbeaccessed
q
E.g.Storerelatedinformationonthesameornearby blocks/cylinders.
Filesmaygetfragmentedovertime
Somesystemshaveutilitiestodefragmentthefilesystem, inordertospeedupfileaccess
11.21 Silberschatz,KorthandSudarshan
DatabaseSystemConcepts5thEdition
OptimizationofDiskBlockAccess(Cont.)
s Nonvolatilewritebuffersspeedupdiskwritesbywritingblocksto
anonvolatileRAMbufferimmediately
q
DatabaseSystemConcepts5thEdition
11.22
Silberschatz,KorthandSudarshan
OptimizationofDiskBlockAccess(Cont.)
s Logdiskadiskdevotedtowritingasequentiallogofblock
updates
q
s Filesystemstypicallyreorderwritestodisktoimprove
performance
q
DatabaseSystemConcepts5thEdition
11.23
Silberschatz,KorthandSudarshan
RAID
s RAID:RedundantArraysofIndependentDisks
q
diskorganizationtechniquesthatmanagealargenumbersof disks,providingaviewofasinglediskof
s ThechancethatsomediskoutofasetofNdiskswillfailismuch
higherthanthechancethataspecificsinglediskwillfail.
q
DatabaseSystemConcepts5thEdition
11.24
Silberschatz,KorthandSudarshan
ImprovementofReliabilityviaRedundancy
s Redundancystoreextrainformationthatcanbeusedto
rebuildinformationlostinadiskfailure
q
s E.g.,Mirroring(orshadowing)
Ifonediskinapairfails,datastillavailableintheother
Exceptfordependentfailuremodessuchasfireor buildingcollapseorelectricalpowersurges
11.25 Silberschatz,KorthandSudarshan
DatabaseSystemConcepts5thEdition
ImprovementofReliabilityviaRedundancy
s Meantimetodatalossdependsonmeantimetofailure,
andmeantimetorepair
q
DatabaseSystemConcepts5thEdition
11.26
Silberschatz,KorthandSudarshan
ImprovementinPerformanceviaParallelism
s Twomaingoalsofparallelisminadisksystem:
1. Loadbalancemultiplesmallaccessestoincreasethroughput 2. Parallelizelargeaccessestoreduceresponsetime.
s Improvetransferratebystripingdataacrossmultipledisks. s Bitlevelstripingsplitthebitsofeachbyteacrossmultipledisks
q
Butseek/accesstimeworsethanforasingledisk
Bitlevelstripingisnotusedmuchanymore
s Blocklevelstripingwithndisks,blockiofafilegoestodisk(i
modn)+1
q
DatabaseSystemConcepts5thEdition
RAIDLevels
s RAIDorganizations,orRAIDlevels,havedifferingcost,
performanceandreliabilitycharacteristics
q
s RAIDLevel0:Blockstriping;nonredundant.
s RAIDLevel1:Mirroreddiskswithblockstriping
q q
DatabaseSystemConcepts5thEdition
11.28
Silberschatz,KorthandSudarshan
RAIDLevels(Cont.)
s RAIDLevel2:MemoryStyleErrorCorrectingCodes(ECC)withbit
striping.
q
s RAIDLevel3:BitInterleavedParity asingleparitybitisenoughforerrorcorrection,notjustdetection
DatabaseSystemConcepts5thEdition
11.29
Silberschatz,KorthandSudarshan
RAIDLevels(Cont.)
s RAIDLevel3(Cont.)
q
Fasterdatatransferthanwithasingledisk,butfewerI/Osper secondsinceeverydiskhastoparticipateineveryI/O.
s RAIDLevel4:BlockInterleavedParity;usesblocklevelstriping,
andkeepsaparityblockonaseparatediskforcorresponding blocksfromNotherdisks.
q
DatabaseSystemConcepts5thEdition
11.30
Silberschatz,KorthandSudarshan
RAIDLevels(Cont.)
s RAIDLevel4(Cont.)
q
ProvideshigherI/OratesforindependentblockreadsthanLevel 3
Beforewritingablock,paritydatamustbecomputed
Parityblockbecomesabottleneckforindependentblockwrites sinceeveryblockwritealsowritestoparitydisk
11.31 Silberschatz,KorthandSudarshan
DatabaseSystemConcepts5thEdition
RAIDLevels(Cont.)
s RAIDLevel5:BlockInterleavedDistributedParity;partitions
dataandparityamongallN+1disks,ratherthanstoringdata inNdisksandparityin1disk.
q
DatabaseSystemConcepts5thEdition
11.32
Silberschatz,KorthandSudarshan
RAIDLevels(Cont.)
s RAIDLevel5(Cont.)
q
HigherI/OratesthanLevel4.
Blockwritesoccurinparalleliftheblocksandtheirparity blocksareondifferentdisks.
SubsumesLevel4:providessamebenefits,butavoids bottleneckofparitydisk.
s RAIDLevel6:P+QRedundancyscheme;similartoLevel5,but
storesextraredundantinformationtoguardagainstmultipledisk failures.
q
BetterreliabilitythanLevel5atahighercost;notusedas widely.
DatabaseSystemConcepts5thEdition
11.33
Silberschatz,KorthandSudarshan
ChoiceofRAIDLevel
s FactorsinchoosingRAIDlevel
q q q q
Includingtimetakentorebuildfaileddisk s RAID0isusedonlywhendatasafetyisnotimportant
q
E.g.datacanberecoveredquicklyfromothersources
s Level2and4neverusedsincetheyaresubsumedby3and5 s Level3isnotusedsincebitstripingforcessingleblockreadsto
accessalldisks,wastingdiskarmmovement formostapplications
s Level6israrelyusedsincelevels1and5offeradequatesafety s Socompetitionismainlybetween1and5
DatabaseSystemConcepts5thEdition 11.34 Silberschatz,KorthandSudarshan
ChoiceofRAIDLevel(Cont.)
s Level1providesmuchbetterwriteperformancethanlevel5
q
s Level1hadhigherstoragecostthanlevel5
q
q q
sothereisoftennoextramonetarycostforLevel1!
s Level5ispreferredforapplicationswithlowupdaterate,
andlargeamountsofdata
s Level1ispreferredforallotherapplications
DatabaseSystemConcepts5thEdition 11.35 Silberschatz,KorthandSudarshan
HardwareIssues
s SoftwareRAID:RAIDimplementationsdoneentirelyinsoftware,
withnospecialhardwaresupport
q q
s HardwareRAID:RAIDimplementationswithspecialhardware
UsenonvolatileRAMtorecordwritesthatarebeingexecuted Beware:powerfailureduringwritecanresultincorrupteddisk
Otherwiseallblocksofdiskmustbereadandcompared withmirror/parityblock
11.36 Silberschatz,KorthandSudarshan
DatabaseSystemConcepts5thEdition
HardwareIssues(Cont.)
s Hotswapping:replacementofdiskwhilesystemisrunning,
withoutpowerdown
q q
SupportedbysomehardwareRAIDsystems, reducestimetorecovery,andimprovesavailabilitygreatly
s Manysystemsmaintainsparediskswhicharekeptonline,and
usedasreplacementsforfaileddisksimmediatelyondetection offailure
q
Reducestimetorecoverygreatly
s ManyhardwareRAIDsystemsensurethatasinglepointof
failurewillnotstopthefunctioningofthesystembyusing
q q
DatabaseSystemConcepts5thEdition
11.37
Silberschatz,KorthandSudarshan
RAIDTerminologyintheIndustry
s RAIDterminologynotverystandardintheindustry
q
E.g.Manyvendorsuse
RAID1:formirroringwithoutstriping RAID10orRAID1+0:formirroringwithstriping
Readthespecscarefully!
s SoftwareRAIDsupporteddirectlyinmostoperatingsystems
today
DatabaseSystemConcepts5thEdition
11.38
Silberschatz,KorthandSudarshan
OpticalDisks
s Compactdiskreadonlymemory(CDROM)
q q
Seektimeabout100msec(opticalreadheadisheavierand slower)
DVD5holds4.7GB,variantsupto17GB Slowseektime,forsamereasonsasCDROM
s Recordonceversions(CDRandDVDR)
DatabaseSystemConcepts5thEdition
11.39
Silberschatz,KorthandSudarshan
MagneticTapes
s Holdlargevolumesofdataandprovidehightransferrates
q
Transferratesfromfewto10sofMB/s s Currentlythecheapeststoragemedium
q q
Tapesarecheap,butcostofdrivesisveryhigh
s Veryslowaccesstimeincomparisontomagneticdisksandoptical
disks
q
limitedtosequentialaccess.
Someformats(Accelis)providefasterseek(10sofseconds)at costoflowercapacity
s Usedmainlyforbackup,forstorageofinfrequentlyusedinformation,
andasanofflinemediumfortransferringinformationfromonesystem toanother.
q
s Tapejukeboxesusedforverylargecapacitystorage
(terabyte(1012bytes)topetabye(1015bytes)
11.40 Silberschatz,KorthandSudarshan
DatabaseSystemConcepts5thEdition
StorageAccess
s Adatabasefileispartitionedintofixedlengthstorageunits
s Databasesystemseekstominimizethenumberofblock
s Bufferportionofmainmemoryavailabletostorecopiesof s Buffermanagersubsystemresponsibleforallocatingbuffer
spaceinmainmemory.
DatabaseSystemConcepts5thEdition
11.41
Silberschatz,KorthandSudarshan
BufferManager
s Programscallonthebuffermanagerwhentheyneedablockfrom
disk.
q
s Buffermanagerdoesthefollowing:
2.
DatabaseSystemConcepts5thEdition
11.42
Silberschatz,KorthandSudarshan
BufferReplacementPolicies
s Mostoperatingsystemsreplacetheblockleastrecentlyused(LRU
strategy)
s IdeabehindLRUusepastpatternofblockreferencesasa
predictoroffuturereferences
s Querieshavewelldefinedaccesspatterns(suchassequential
scans),andadatabasesystemcanusetheinformationinausers querytopredictfuturereferences
q
LRUcanbeabadstrategyforcertainaccesspatternsinvolving repeatedscansofdata
Mixedstrategywithhintsonreplacementstrategyprovided bythequeryoptimizerispreferable
11.43 Silberschatz,KorthandSudarshan
DatabaseSystemConcepts5thEdition
BufferReplacementPolicies(Cont.)
s Pinnedblockmemoryblockthatisnotallowedtobe
writtenbacktodisk.
s Tossimmediatestrategyfreesthespaceoccupiedbya
blockassoonasthefinaltupleofthatblockhasbeen processed
s Mostrecentlyused(MRU)strategysystemmustpinthe
s Buffermanagercanusestatisticalinformationregardingthe
E.g.,thedatadictionaryisfrequentlyaccessed.Heuristic: keepdatadictionaryblocksinmainmemorybuffer
s Buffermanagersalsosupportforcedoutputofblocksforthe
purposeofrecovery(moreinChapter17)
11.44
DatabaseSystemConcepts5thEdition
Silberschatz,KorthandSudarshan
FileOrganization
s Thedatabaseisstoredasacollectionoffiles.Eachfileisa
sequenceofrecords.Arecordisasequenceoffields.
qassumerecordsizeisfixed qeachfilehasrecordsofoneparticulartypeonly qdifferentfilesareusedfordifferentrelations
s Oneapproach:
Thiscaseiseasiesttoimplement;willconsidervariablelength recordslater.
DatabaseSystemConcepts5thEdition
11.45
Silberschatz,KorthandSudarshan
FixedLengthRecords
s Simpleapproach:
q
Modification:donotallowrecordstocrossblock boundaries
s Deletionofrecordi:
alternatives:
q
q q
DatabaseSystemConcepts5thEdition
FreeLists
s Storetheaddressofthefirstdeletedrecordinthefileheader. s Usethisfirstrecordtostoretheaddressoftheseconddeleted
record,andsoon
s Canthinkofthesestoredaddressesaspointerssincethey
pointtothelocationofarecord.
s Morespaceefficientrepresentation:reusespacefornormal
attributesoffreerecordstostorepointers.(Nopointersstored ininuserecords.)
DatabaseSystemConcepts5thEdition
11.47
Silberschatz,KorthandSudarshan
VariableLengthRecords
s Variablelengthrecordsariseindatabasesystemsin
severalways:
q q
DatabaseSystemConcepts5thEdition
11.48
Silberschatz,KorthandSudarshan
VariableLengthRecords:SlottedPage Structure
s Slottedpageheadercontains:
q q q
s Recordscanbemovedaroundwithinapagetokeepthem
s Pointersshouldnotpointdirectlytorecordinsteadthey
DatabaseSystemConcepts5thEdition Silberschatz,KorthandSudarshan
OrganizationofRecordsinFiles
s Heaparecordcanbeplacedanywhereinthefilewhere
thereisspace
s Sequentialstorerecordsinsequentialorder,basedonthe
valueofthesearchkeyofeachrecord
s Hashingahashfunctioncomputedonsomeattributeof
s Recordsofeachrelationmaybestoredinaseparatefile.Ina
Motivation:storerelatedrecordsonthesameblockto minimizeI/O
DatabaseSystemConcepts5thEdition
11.50
Silberschatz,KorthandSudarshan
SequentialFileOrganization
s Suitableforapplicationsthatrequiresequential
processingoftheentirefile
s Therecordsinthefileareorderedbyasearchkey
DatabaseSystemConcepts5thEdition
11.51
Silberschatz,KorthandSudarshan
SequentialFileOrganization(Cont.)
s Deletionusepointerchains s Insertionlocatethepositionwheretherecordistobeinserted
q q q
s Needtoreorganizethefile
fromtimetotimetorestore sequentialorder
DatabaseSystemConcepts5thEdition
11.52
Silberschatz,KorthandSudarshan
MultitableClusteringFileOrganization(cont.)
s Storeseveralrelationsinonefileusingamultitable
clusteringfileorganization
s Multitableclusteringorganizationofcustomeranddepositor:
q q
DatabaseSystemConcepts5thEdition
DataDictionaryStorage
Datadictionary(alsocalledsystemcatalog)stores metadata:thatis,dataaboutdata,suchas
s Informationaboutrelations
q q q q
s Userandaccountinginformation,includingpasswords s Statisticalanddescriptivedata
q
s Physicalfileorganizationinformation
q q
s Informationaboutindices(Chapter12)
DatabaseSystemConcepts5thEdition
DataDictionaryStorage(Cont.)
s Catalogstructure
q q
s Apossiblecatalogrepresentation:
DatabaseSystemConcepts5thEdition
11.55
Silberschatz,KorthandSudarshan
ExtraSlides
DatabaseSystemConcepts,5thEd.
Silberschatz,KorthandSudarshan Seewww.dbbook.comforconditionsonreuse
RecordRepresentation
s Recordswithfixedlengthfieldsareeasytorepresent
q q
Similartorecords(structs)inprogramminglanguages Extensionstorepresentnullvalues
E.g.abitmapindicatingwhichattributesarenull
s Variablelengthfieldscanberepresentedbyapair
(offset,length) offset:thelocationwithintherecord,length:fieldlength.
q
Allfieldsstartatpredefinedlocation,butextraindirection requiredforvariablelengthfields
400 Perryridge
A102
10
000
EndofChapter
DatabaseSystemConcepts,5thEd.
Silberschatz,KorthandSudarshan Seewww.dbbook.comforconditionsonreuse
FileContainingaccountRecords
DatabaseSystemConcepts5thEdition
11.59
Silberschatz,KorthandSudarshan
FileofFigure11.6,withRecord2Deletedand AllRecordsMoved
DatabaseSystemConcepts5thEdition
11.60
Silberschatz,KorthandSudarshan
FileofFigure11.6,WithRecord2deletedand FinalRecordMoved
DatabaseSystemConcepts5thEdition
11.61
Silberschatz,KorthandSudarshan
ByteStringRepresentationofVariableLength Records
DatabaseSystemConcepts5thEdition
11.62
Silberschatz,KorthandSudarshan
ClusteringFileStructure
DatabaseSystemConcepts5thEdition
11.63
Silberschatz,KorthandSudarshan
ClusteringFileStructureWithPointerChains
DatabaseSystemConcepts5thEdition
11.64
Silberschatz,KorthandSudarshan
ThedepositorRelation
DatabaseSystemConcepts5thEdition
11.65
Silberschatz,KorthandSudarshan
ThecustomerRelation
DatabaseSystemConcepts5thEdition
11.66
Silberschatz,KorthandSudarshan
ClusteringFileStructure
DatabaseSystemConcepts5thEdition
11.67
Silberschatz,KorthandSudarshan
DatabaseSystemConcepts5thEdition
11.68
Silberschatz,KorthandSudarshan
Figure11.4
DatabaseSystemConcepts5thEdition
11.69
Silberschatz,KorthandSudarshan
Figure11.7
DatabaseSystemConcepts5thEdition
11.70
Silberschatz,KorthandSudarshan
Figure11.8
DatabaseSystemConcepts5thEdition
11.71
Silberschatz,KorthandSudarshan
Figure11.20
DatabaseSystemConcepts5thEdition
11.72
Silberschatz,KorthandSudarshan
ByteStringRepresentationofVariableLengthRecords
DatabaseSystemConcepts5thEdition
11.73
Silberschatz,KorthandSudarshan
FixedLengthRepresentation
s Useoneormorefixedlengthrecords:
q q
reservedspace pointers
s Reservedspacecanusefixedlengthrecordsofaknown
maximumlength;unusedspaceinshorterrecordsfilledwithanull orendofrecordsymbol.
DatabaseSystemConcepts5thEdition
11.74
Silberschatz,KorthandSudarshan
PointerMethod
s Pointermethod
q
DatabaseSystemConcepts5thEdition
11.75
Silberschatz,KorthandSudarshan
PointerMethod(Cont.)
s Disadvantagetopointerstructure;spaceiswastedinall
recordsexceptthefirstinaachain.
q q
s Solutionistoallowtwokindsofblockinfile:
DatabaseSystemConcepts5thEdition
11.76
Silberschatz,KorthandSudarshan
MappingofObjectstoFiles
s Mappingobjectstofilesissimilartomappingtuplestofilesinarelational
system;objectdatacanbestoredusingfilestructures.
s ObjectsinOOdatabasesmaylackuniformityandmaybeverylarge;
suchobjectshavetomanageddifferentlyfromrecordsinarelational system.
q
SimilartoconversionofmultivaluedattributesofERdiagramsto relations
DatabaseSystemConcepts5thEdition
11.77
Silberschatz,KorthandSudarshan
MappingofObjectstoFiles(Cont.)
s Objectsareidentifiedbyanobjectidentifier(OID);thestoragesystem
needsamechanismtolocateanobjectgivenitsOID(thisactionis calleddereferencing).
q
DatabaseSystemConcepts5thEdition
11.78
Silberschatz,KorthandSudarshan
ManagementofPersistentPointers
s PhysicalOIDsmaybeauniqueidentifier.Thisidentifieris
storedintheobjectalsoandisusedtodetectreferencesvia danglingpointers.
DatabaseSystemConcepts5thEdition
11.79
Silberschatz,KorthandSudarshan
ManagementofPersistentPointers (Cont.)
s ImplementpersistentpointersusingOIDs;persistentpointersare
substantiallylongerthanareinmemorypointers alreadyinmemory.
q
s Pointerswizzlingcutsdownoncostoflocatingpersistentobjects s Softwareswizzling(swizzlingonpointerdeference)
q q
DatabaseSystemConcepts5thEdition
11.80
Silberschatz,KorthandSudarshan
HardwareSwizzling
s Withhardwareswizzling,persistentpointersinobjectsneedthe
sameamountofspaceasinmemorypointersextrastorage externaltotheobjectisusedtostorerestofpointerinformation.
s Usesvirtualmemorytranslationmechanismtoefficientlyand
s Allpersistentpointersinapageareswizzledwhenthepageis
DatabaseSystemConcepts5thEdition
11.81
Silberschatz,KorthandSudarshan
HardwareSwizzling
s Persistentpointerisconceptuallysplitintotwoparts:apageidentifier,
andanoffsetwithinthepage.
q
DatabaseSystemConcepts5thEdition
11.82
Silberschatz,KorthandSudarshan
HardwareSwizzling(Cont.)
s Pageimagebeforeswizzling(pagelocatedondisk)
DatabaseSystemConcepts5thEdition
11.83
Silberschatz,KorthandSudarshan
HardwareSwizzling(Cont.)
s
Whensystemloadsapageintomemorythepersistentpointersinthepage areswizzledasdescribedbelow
1.
IfPidoesnotalreadyhaveavirtualmemorypageallocatedtoit, allocateavirtualmemorypagetoPiandreadprotectthepage
5 5
LetvibethevirtualpageallocatedtoPi(eitherearlierorabove) Replace(pi,oi)by(vi,o11.84 i)
Silberschatz,KorthandSudarshan
DatabaseSystemConcepts5thEdition
HardwareSwizzling(Cont.)
s
s s
2. 3.
DatabaseSystemConcepts5thEdition
11.85
Silberschatz,KorthandSudarshan
HardwareSwizzling(Cont.)
Pageimageafterswizzling
s Pagewithshortpageidentifier2395wasallocatedaddress5001.
Observechangeinpointersandtranslationtable.
s Pagewithshortpageidentifier4867hasbeenallocatedaddress
4867.Nochangeinpointerandtranslationtable.
11.86
DatabaseSystemConcepts5thEdition
Silberschatz,KorthandSudarshan
HardwareSwizzling(Cont.)
s Afterswizzling,allshortpageidentifierspointtovirtualmemoryaddresses
allocatedforthecorrespondingpages
q
s Afterthis,thepointerdereferencethattriggeredtheswizzlingcancontinue s Optimizations:
q
q q
s Aprocessshouldnotaccessmorepagesthansizeofvirtualmemory
reuseofvirtualmemoryaddressesforotherpagesisexpensive
11.87
DatabaseSystemConcepts5thEdition
Silberschatz,KorthandSudarshan
DiskversusMemoryStructureofObjects
s Theformatinwhichobjectsarestoredinmemorymaybedifferentfrom
theformalinwhichtheyarestoredondiskinthedatabase.Reasons are:
q
DatabaseSystemConcepts5thEdition
11.88
Silberschatz,KorthandSudarshan
LargeObjects
s Largeobjects:binarylargeobjects(blobs)andcharacterlarge
objects(clobs)
q
s Largeobjectsmayneedtobestoredinacontiguoussequenceof
byteswhenbroughtintomemory.
q
DatabaseSystemConcepts5thEdition
11.89
Silberschatz,KorthandSudarshan
ModifyingLargeObjects
s Iftheapplicationrequiresinsert/deleteofbytesfromspecifiedregionsof
anobject:
q
s Specialpurposeapplicationprogramsoutsidethedatabaseareusedto
manipulatelargeobjects:
q
DatabaseSystemConcepts5thEdition
11.90
Silberschatz,KorthandSudarshan