Database Visit to download the full and correct content document: https://ebookmass.com/product/database-system-concepts-6th-edition-ebook-pdf/
More products digital (pdf, epub, mobi) instant download maybe you interests ...
Database System Concepts 7th Edition Avi Silberschatz
https://ebookmass.com/product/database-system-concepts-7thedition-avi-silberschatz/
Database System Concepts 7th Edition Abraham Silberschatz
https://ebookmass.com/product/database-system-concepts-7thedition-abraham-silberschatz/
(eBook PDF) Operating System Concepts, 10th Edition
https://ebookmass.com/product/ebook-pdf-operating-systemconcepts-10th-edition/
(eTextbook PDF) for Database Concepts 8th Edition by David M. Kroenke
https://ebookmass.com/product/etextbook-pdf-for-databaseconcepts-8th-edition-by-david-m-kroenke/
(eBook PDF) Concepts of Database Management , 9th Edition Joy L. Starks
https://ebookmass.com/product/ebook-pdf-concepts-of-databasemanagement-9th-edition-joy-l-starks/
Concepts of database management 10th Edition Lisa Friedrichsen
https://ebookmass.com/product/concepts-of-databasemanagement-10th-edition-lisa-friedrichsen/
Policy Analysis: Concepts and Practice 6th Edition, (Ebook PDF)
https://ebookmass.com/product/policy-analysis-concepts-andpractice-6th-edition-ebook-pdf/
Theories of Development: Concepts and Applications 6th Edition, (Ebook PDF)
https://ebookmass.com/product/theories-of-development-conceptsand-applications-6th-edition-ebook-pdf/
Graph Database and Graph Computing for Power System Analysis Renchang Dai
https://ebookmass.com/product/graph-database-and-graph-computingfor-power-system-analysis-renchang-dai/
Chapter8RelationalDatabaseDesign 8.1FeaturesofGoodRelational Designs323
8.2AtomicDomainsandFirstNormal Form327
8.3DecompositionUsingFunctional Dependencies329
8.4Functional-DependencyTheory338
8.5AlgorithmsforDecomposition348
8.6DecompositionUsingMultivalued Dependencies355
8.7MoreNormalForms360
8.8Database-DesignProcess361
8.9ModelingTemporalData364
8.10Summary367 Exercises368
BibliographicalNotes374
Chapter9ApplicationDesignandDevelopment 9.1ApplicationProgramsandUser Interfaces375
9.2WebFundamentals377
9.3ServletsandJSP383
9.4ApplicationArchitectures391
9.5RapidApplicationDevelopment396
9.6ApplicationPerformance400
9.7ApplicationSecurity402
9.8EncryptionandItsApplications411
9.9Summary417 Exercises419
BibliographicalNotes426
PARTTHREE DATASTORAGEANDQUERYING Chapter10StorageandFileStructure 10.1OverviewofPhysicalStorage Media429
10.2MagneticDiskandFlashStorage432
10.3RAID441
10.4TertiaryStorage449
10.5FileOrganization451
10.6OrganizationofRecordsinFiles457
10.7Data-DictionaryStorage462
10.8DatabaseBuffer464
10.9Summary468 Exercises470 BibliographicalNotes473
Chapter11IndexingandHashing 11.1BasicConcepts475
11.2OrderedIndices476
11.3B+ -TreeIndexFiles485
11.4B+ -TreeExtensions500
11.5Multiple-KeyAccess506
11.6StaticHashing509
11.7DynamicHashing515
11.8ComparisonofOrderedIndexingand Hashing523
11.9BitmapIndices524
11.10IndexDefinitioninSQL528
11.11Summary529 Exercises532
BibliographicalNotes536
Chapter12QueryProcessing 12.1Overview537
12.2MeasuresofQueryCost540
12.3SelectionOperation541
12.4Sorting546
12.5JoinOperation549
Chapter13QueryOptimization 13.1Overview579
13.2TransformationofRelational Expressions582
13.3EstimatingStatisticsofExpression Results590
13.4ChoiceofEvaluationPlans598
12.6OtherOperations563
12.7EvaluationofExpressions567
12.8Summary572 Exercises574 BibliographicalNotes577
13.5MaterializedViews**607
13.6AdvancedTopicsinQuery Optimization**612
13.7Summary615 Exercises617 BibliographicalNotes622 PARTFOUR
Chapter14Transactions 14.1TransactionConcept627
14.2ASimpleTransactionModel629
14.3StorageStructure632
14.4TransactionAtomicityand Durability633
14.5TransactionIsolation635
14.6Serializability641
Chapter15ConcurrencyControl 15.1Lock-BasedProtocols661
15.2DeadlockHandling674
15.3MultipleGranularity679
15.4Timestamp-BasedProtocols682
15.5Validation-BasedProtocols686
15.6MultiversionSchemes689
15.7SnapshotIsolation692
14.7TransactionIsolationand Atomicity646
14.8TransactionIsolationLevels648
14.9ImplementationofIsolationLevels650
14.10TransactionsasSQLStatements653
14.11Summary655 Exercises657 BibliographicalNotes660
15.8InsertOperations,DeleteOperations, andPredicateReads697
15.9WeakLevelsofConsistencyin Practice701
15.10ConcurrencyinIndexStructures**704 15.11Summary708 Exercises712 BibliographicalNotes718
Chapter16RecoverySystem 16.1FailureClassification721
16.2Storage722
16.3RecoveryandAtomicity726
16.4RecoveryAlgorithm735
16.5BufferManagement738
16.6FailurewithLossofNonvolatile Storage743
16.7EarlyLockReleaseandLogicalUndo Operations744
16.8ARIES**750
16.9RemoteBackupSystems756
16.10Summary759 Exercises762
BibliographicalNotes766
PARTFIVE SYSTEMARCHITECTURE Chapter17Database-SystemArchitectures 17.1CentralizedandClient–Server Architectures769
17.2ServerSystemArchitectures772
17.3ParallelSystems777
17.4DistributedSystems784
Chapter18ParallelDatabases 18.1Introduction797
18.2I/OParallelism798
18.3InterqueryParallelism802
18.4IntraqueryParallelism803
18.5IntraoperationParallelism804
18.6InteroperationParallelism813
18.7QueryOptimization814
17.5NetworkTypes788
17.6Summary791 Exercises793
BibliographicalNotes794
18.8DesignofParallelSystems815
18.9ParallelismonMulticore Processors817
18.10Summary819 Exercises821 BibliographicalNotes824
Chapter19DistributedDatabases 19.1HomogeneousandHeterogeneous Databases825
19.2DistributedDataStorage826
19.3DistributedTransactions830
19.4CommitProtocols832
19.5ConcurrencyControlinDistributed Databases839
19.6Availability847
19.7DistributedQueryProcessing854
19.8HeterogeneousDistributed Databases857
19.9Cloud-BasedDatabases861
19.10DirectorySystems870
19.11Summary875 Exercises879
BibliographicalNotes883
PARTSIX DATAWAREHOUSING,DATA MINING,ANDINFORMATIONRETRIEVAL Chapter20DataWarehousingandMining
20.1Decision-SupportSystems887
20.2DataWarehousing889
20.3DataMining893
20.4Classification894
20.5AssociationRules904
20.6OtherTypesofAssociations906
Chapter21InformationRetrieval 21.1Overview915
21.2RelevanceRankingUsingTerms917
21.3RelevanceUsingHyperlinks920
21.4Synonyms,Homonyms,and Ontologies925
21.5IndexingofDocuments927
21.6MeasuringRetrievalEffectiveness929
20.7Clustering907
20.8OtherFormsofDataMining908
20.9Summary909
Exercises911
BibliographicalNotes914
21.7CrawlingandIndexingtheWeb930
21.8InformationRetrieval:BeyondRanking ofPages931
21.9DirectoriesandCategories935
21.10Summary937 Exercises939
BibliographicalNotes941
PARTSEVEN SPECIALTYDATABASES Chapter22Object-BasedDatabases
22.1Overview945
22.2ComplexDataTypes946
22.3StructuredTypesandInheritancein SQL949
22.4TableInheritance954
22.5ArrayandMultisetTypesinSQL956
22.6Object-IdentityandReferenceTypesin SQL961
22.7ImplementingO-RFeatures963
Chapter23XML 23.1Motivation981
23.2StructureofXMLData986
23.3XMLDocumentSchema990
23.4QueryingandTransformation998
23.5ApplicationProgramInterfacesto XML1008
22.8PersistentProgramming Languages964
22.9Object-RelationalMapping973
22.10Object-Orientedversus Object-Relational973
22.11Summary975 Exercises976
BibliographicalNotes980
23.6StorageofXMLData1009
23.7XMLApplications1016
23.8Summary1019 Exercises1021
BibliographicalNotes1024
PARTEIGHT ADVANCEDTOPICS Chapter24AdvancedApplicationDevelopment
24.1PerformanceTuning1029
24.2PerformanceBenchmarks1045
24.3OtherIssuesinApplication Development1048
24.4Standardization1051
24.5Summary1056
Exercises1057
BibliographicalNotes1059
Chapter25SpatialandTemporalDataandMobility
25.1Motivation1061
25.2TimeinDatabases1062
25.3SpatialandGeographicData1064
25.4MultimediaDatabases1076
25.5MobilityandPersonalDatabases1079
25.6Summary1085
Exercises1087
BibliographicalNotes1089
Chapter26AdvancedTransactionProcessing 26.1Transaction-ProcessingMonitors1091
26.2TransactionalWorkflows1096
26.3E-Commerce1102
26.4Main-MemoryDatabases1105
26.5Real-TimeTransactionSystems1108
PARTNINE 26.6Long-DurationTransactions1109
26.7Summary1115
Exercises1117
BibliographicalNotes1119
CASESTUDIES Chapter27PostgreSQL 27.1Introduction1123
27.2UserInterfaces1124
27.3SQLVariationsandExtensions1126
27.4TransactionManagementin PostgreSQL1137
Chapter28Oracle 28.1DatabaseDesignandQuerying Tools1157
28.2SQLVariationsandExtensions1158
28.3StorageandIndexing1162
28.4QueryProcessingand Optimization1172
28.5ConcurrencyControland Recovery1180
27.5StorageandIndexing1146
27.6QueryProcessingand Optimization1151
27.7SystemArchitecture1154
BibliographicalNotes1155
28.6SystemArchitecture1183
28.7Replication,Distribution,andExternal Data1188
28.8DatabaseAdministrationTools1189
28.9DataMining1191
BibliographicalNotes1191
Chapter29IBMDB2UniversalDatabase 29.1Overview1193
29.2Database-DesignTools1194
29.3SQLVariationsandExtensions1195
29.4StorageandIndexing1200
29.5MultidimensionalClustering1203
29.6QueryProcessingand Optimization1207
29.7MaterializedQueryTables1212
29.8AutonomicFeaturesinDB21214
29.9ToolsandUtilities1215
29.10ConcurrencyControland Recovery1217
29.11SystemArchitecture1219
29.12Replication,Distribution,andExternal Data1220
29.13BusinessIntelligenceFeatures1221 BibliographicalNotes1222
Chapter30MicrosoftSQLServer 30.1Management,Design,andQuerying Tools1223
30.2SQLVariationsandExtensions1228
30.3StorageandIndexing1233
30.4QueryProcessingand Optimization1236
30.5ConcurrencyandRecovery1241
30.6SystemArchitecture1246
30.7DataAccess1248
PARTTEN 30.8DistributedHeterogeneousQuery Processing1250
30.9Replication1251
30.10ServerProgrammingin.NET1253
30.11XMLSupport1258
30.12SQLServerServiceBroker1261
30.13BusinessIntelligence1263 BibliographicalNotes1267
APPENDICES AppendixADetailedUniversitySchema
A.1FullSchema1271
A.2DDL1272
A.3SampleData1276
AppendixBAdvancedRelationalDesign(contentsonline)
B.1MultivaluedDependenciesB1
B.3Domain-KeyNormalFormB8
B.4SummaryB10 ExercisesB10 BibliographicalNotesB12
AppendixCOtherRelationalQueryLanguages(contentsonline)
C.1Query-by-ExampleC1
C.2MicrosoftAccessC9
C.3DatalogC11
C.4SummaryC25 ExercisesC26 BibliographicalNotesC30
AppendixDNetworkModel(contentsonline) D.1BasicConceptsD1
D.2Data-StructureDiagramsD2
D.3TheDBTGCODASYLModelD7
D.4DBTGData-RetrievalFacilityD13
D.5DBTGUpdateFacilityD20
D.6DBTGSet-ProcessingFacilityD22
D.7MappingofNetworkstoFilesD27
D.8SummaryD31
ExercisesD32
BibliographicalNotesD35
AppendixEHierarchicalModel(contentsonline) E.1BasicConceptsE1
E.2Tree-StructureDiagramsE2
E.3Data-RetrievalFacilityE13
E.4UpdateFacilityE17
E.5VirtualRecordsE20
Bibliography1283
Index1315
E.6MappingofHierarchiestoFilesE22
E.7TheIMSDatabaseSystemE24
E.8SummaryE25
ExercisesE26
BibliographicalNotesE29
This page intentionally left blank
Preface Databasemanagementhasevolvedfromaspecializedcomputerapplicationtoa centralcomponentofamoderncomputingenvironment,and,asaresult,knowledgeaboutdatabasesystemshasbecomeanessentialpartofaneducationin computerscience.Inthistext,wepresentthefundamentalconceptsofdatabase management.Theseconceptsincludeaspectsofdatabasedesign,databaselanguages,anddatabase-systemimplementation.
Thistextisintendedforafirstcourseindatabasesatthejuniororsenior undergraduate,orfirst-yeargraduate,level.Inadditiontobasicmaterialfor afirstcourse,thetextcontainsadvancedmaterialthatcanbeusedforcourse supplements,orasintroductorymaterialforanadvancedcourse.
Weassumeonlyafamiliaritywithbasicdatastructures,computerorganization,andahigh-levelprogramminglanguagesuchasJava,C,orPascal.We presentconceptsasintuitivedescriptions,manyofwhicharebasedonourrunningexampleofauniversity.Importanttheoreticalresultsarecovered,butformal proofsareomitted.Inplaceofproofs,figuresandexamplesareusedtosuggest whyaresultistrue.Formaldescriptionsandproofsoftheoreticalresultsmay befoundinresearchpapersandadvancedtextsthatarereferencedinthebibliographicalnotes.
Thefundamentalconceptsandalgorithmscoveredinthebookareoften basedonthoseusedinexistingcommercialorexperimentaldatabasesystems. Ouraimistopresenttheseconceptsandalgorithmsinageneralsettingthatis nottiedtooneparticulardatabasesystem.Detailsofparticulardatabasesystems arediscussedinPart9, “CaseStudies.”
Inthis,thesixtheditionof DatabaseSystemConcepts,wehaveretainedthe overallstyleoftheprioreditionswhileevolvingthecontentandorganizationto reflectthechangesthatareoccurringinthewaydatabasesaredesigned,managed, andused.Wehavealsotakenintoaccounttrendsintheteachingofdatabase conceptsandmadeadaptationstofacilitatethesetrendswhereappropriate.
Organization Thetextisorganizedinninemajorparts,plusfiveappendices.
• Overview (Chapter1).Chapter1providesageneraloverviewofthenature andpurposeofdatabasesystems.Weexplainhowtheconceptofadatabase systemhasdeveloped,whatthecommonfeaturesofdatabasesystemsare, whatadatabasesystemdoesfortheuser,andhowadatabasesysteminterfaceswithoperatingsystems.Wealsointroduceanexampledatabase application:auniversityorganizationconsistingofmultipledepartments, instructors,students,andcourses.Thisapplicationisusedasarunningexamplethroughoutthebook.Thischapterismotivational,historical,andexplanatoryinnature.
• Part1:RelationalDatabases (Chapters2through6).Chapter2introduces therelationalmodelofdata,coveringbasicconceptssuchasthestructure ofrelationaldatabases,databaseschemas,keys,schemadiagrams,relational querylanguages,andrelationaloperations.Chapters3,4,and5focusonthe mostinfluentialoftheuser-orientedrelationallanguages: SQL.Chapter6coverstheformalrelationalquerylanguages:relationalalgebra,tuplerelational calculus,anddomainrelationalcalculus.
Thechaptersinthispartdescribedatamanipulation:queries,updates,insertions,anddeletions,assumingaschemadesignhasbeenprovided.Schema designissuesaredeferredtoPart2.
• Part2:DatabaseDesign (Chapters7through9).Chapter7providesan overviewofthedatabase-designprocess,withmajoremphasisondatabase designusingtheentity-relationshipdatamodel.Theentity-relationshipdata modelprovidesahigh-levelviewoftheissuesindatabasedesign,andofthe problemsthatweencounterincapturingthesemanticsofrealisticapplicationswithintheconstraintsofadatamodel. UML class-diagramnotationis alsocoveredinthischapter.
Chapter8introducesthetheoryofrelationaldatabasedesign.Thetheoryoffunctionaldependenciesandnormalizationiscovered,withemphasis onthemotivationandintuitiveunderstandingofeachnormalform.This chapterbeginswithanoverviewofrelationaldesignandreliesonanintuitiveunderstandingoflogicalimplicationoffunctionaldependencies.This allowstheconceptofnormalizationtobeintroducedpriortofullcoverage offunctional-dependencytheory,whichispresentedlaterinthechapter.InstructorsmaychoosetouseonlythisinitialcoverageinSections8.1through 8.3withoutlossofcontinuity.Instructorscoveringtheentirechapterwillbenefitfromstudentshavingagoodunderstandingofnormalizationconceptsto motivatesomeofthechallengingconceptsoffunctional-dependencytheory.
Chapter9coversapplicationdesignanddevelopment.ThischapteremphasizestheconstructionofdatabaseapplicationswithWeb-basedinterfaces.In addition,thechaptercoversapplicationsecurity.
• Part3:DataStorageandQuerying (Chapters10through13).Chapter10 dealswithstoragedevices,files,anddata-storagestructures.Avarietyof data-accesstechniquesarepresentedinChapter11,includingB+ -treeindices andhashing.Chapters12and13addressquery-evaluationalgorithmsand queryoptimization.Thesechaptersprovideanunderstandingoftheinternals ofthestorageandretrievalcomponentsofadatabase.
• Part4:TransactionManagement (Chapters14through16).Chapter14focusesonthefundamentalsofatransaction-processingsystem:atomicity, consistency,isolation,anddurability.Itprovidesanoverviewofthemethods usedtoensuretheseproperties,includinglockingandsnapshotisolation. Chapter15focusesonconcurrencycontrolandpresentsseveraltechniques forensuringserializability,includinglocking,timestamping,andoptimistic (validation)techniques.Thechapteralsocoversdeadlockissues.Alternativestoserializabilityarecovered,mostnotablythewidely-usedsnapshot isolation,whichisdiscussedindetail.
Chapter16coverstheprimarytechniquesforensuringcorrecttransactionexecutiondespitesystemcrashesandstoragefailures.Thesetechniques includelogs,checkpoints,anddatabasedumps.Thewidely-used ARIES algorithmispresented.
• Part5:SystemArchitecture (Chapters17through19).Chapter17covers computer-systemarchitecture,anddescribestheinfluenceoftheunderlyingcomputersystemonthedatabasesystem.Wediscusscentralizedsystems,client–serversystems,andparallelanddistributedarchitecturesinthis chapter.
Chapter18,onparalleldatabases,exploresavarietyofparallelization techniques,including I/O parallelism,interqueryandintraqueryparallelism, andinteroperationandintraoperationparallelism.Thechapteralsodescribes parallel-systemdesign.
Chapter19coversdistributeddatabasesystems,revisitingtheissues ofdatabasedesign,transactionmanagement,andqueryevaluationandoptimization,inthecontextofdistributeddatabases.Thechapteralsocoversissuesofsystemavailabilityduringfailures,heterogeneousdistributed databases,cloud-baseddatabases,anddistributeddirectorysystems.
• Part6:DataWarehousing,DataMining,andInformationRetrieval (Chapters20and21).Chapter20introducestheconceptsofdatawarehousing anddatamining.Chapter21describesinformation-retrievaltechniquesfor queryingtextualdata,includinghyperlink-basedtechniquesusedinWeb searchengines.
Part6usesthemodelingandlanguageconceptsfromParts1and2,but doesnotdependonParts3,4,or5.Itcanthereforebeincorporatedeasily intoacoursethatfocuseson SQL andondatabasedesign.
• Part7:SpecialtyDatabases (Chapters22and23).Chapter22coversobjectbaseddatabases.Thechapterdescribestheobject-relationaldatamodel, whichextendstherelationaldatamodeltosupportcomplexdatatypes,type inheritance,andobjectidentity.Thechapteralsodescribesdatabaseaccess fromobject-orientedprogramminglanguages.
Chapter23coversthe XML standardfordatarepresentation,whichisseeing increasinguseintheexchangeandstorageofcomplexdata.Thechapteralso describesquerylanguagesfor XML.
• Part8:AdvancedTopics (Chapters24through26).Chapter24coversadvancedissuesinapplicationdevelopment,includingperformancetuning, performancebenchmarks,database-applicationtesting,andstandardization. Chapter25coversspatialandgeographicdata,temporaldata,multimedia data,andissuesinthemanagementofmobileandpersonaldatabases.
Finally,Chapter26dealswithadvancedtransactionprocessing.Topicscoveredinthechapterincludetransaction-processingmonitors,transactionalworkflows,electroniccommerce,high-performancetransactionsystems,real-timetransactionsystems,andlong-durationtransactions.
• Part9:CaseStudies (Chapters27through30).Inthispart,wepresentcase studiesoffouroftheleadingdatabasesystems,PostgreSQL,Oracle, IBMDB2, andMicrosoft SQL Server.Thesechaptersoutlineuniquefeaturesofeachof thesesystems,anddescribetheirinternalstructure.Theyprovideawealthof interestinginformationabouttherespectiveproducts,andhelpyouseehow thevariousimplementationtechniquesdescribedinearlierpartsareused inrealsystems.Theyalsocoverseveralinterestingpracticalaspectsinthe designofrealsystems.
• Appendices.Weprovidefiveappendicesthatcovermaterialthatisofhistoricalnatureorisadvanced;theseappendicesareavailableonlyonlineonthe Websiteofthebook(http://www.db-book.com).AnexceptionisAppendixA, whichpresentsdetailsofouruniversityschemaincludingthefullschema, DDL,andallthetables.Thisappendixappearsintheactualtext.
AppendixBdescribesotherrelationalquerylanguages,including QBE MicrosoftAccess,andDatalog.
AppendixCdescribesadvancedrelationaldatabasedesign,includingthe theoryofmultivalueddependencies,joindependencies,andtheproject-join anddomain-keynormalforms.Thisappendixisforthebenefitofindividuals whowishtostudythetheoryofrelationaldatabasedesigninmoredetail, andinstructorswhowishtodosointheircourses.Thisappendix,too,is availableonlyonline,ontheWebsiteofthebook.
Althoughmostnewdatabaseapplicationsuseeithertherelationalmodel ortheobject-relationalmodel,thenetworkandhierarchicaldatamodelsare stillinuseinsomelegacyapplications.Forthebenefitofreaderswhowishto learnaboutthesedatamodels,weprovideappendicesdescribingthenetwork andhierarchicaldatamodels,inAppendicesDandErespectively.
TheSixthEdition Theproductionofthissixtheditionhasbeenguidedbythemanycommentsand suggestionswereceivedconcerningtheearliereditions,byourownobservations whileteachingatYaleUniversity,LehighUniversity,and IIT Bombay,andbyour analysisofthedirectionsinwhichdatabasetechnologyisevolving.
Wehavereplacedtheearlierrunningexampleofbankenterprisewithauniversityexample.Thisexamplehasanimmediateintuitiveconnectiontostudents thatassistsnotonlyinrememberingtheexample,but,moreimportantly,ingainingdeeperinsightintothevariousdesigndecisionsthatneedtobemade.
Wehavereorganizedthebooksoastocollectallofour SQL coveragetogether andplaceitearlyinthebook.Chapters3,4,and5presentcomplete SQL coverage. Chapter3presentsthebasicsofthelanguage,withmoreadvancedfeaturesin Chapter4.InChapter5,wepresent JDBC alongwithothermeansofaccessing SQL fromageneral-purposeprogramminglanguage.Wepresenttriggersandrecursion,andthenconcludewithcoverageofonlineanalyticprocessing(OLAP). Introductorycoursesmaychoosetocover onlycertainsectionsofChapter5or defersectionsuntilafterthecoverageofdatabasedesignwithoutlossofcontinuity.
Beyondthesetwomajorchanges,werevisedthematerialineachchapter, bringingtheoldermaterialup-to-date,addingdiscussionsonrecentdevelopmentsindatabasetechnology,andimprovingdescriptionsoftopicsthatstudents founddifficulttounderstand.Wehavealsoaddednewexercisesandupdated references.Thelistofspecificchangesincludesthefollowing:
• Earliercoverageof SQL. Manyinstructorsuse SQL asakeycomponentofterm projects(seeourWebsite, www.db-book.com,forsampleprojects).Inorderto givestudentsampletimefortheprojects,particularlyforuniversitiesand collegesonthequartersystem,itisessentialtoteach SQL asearlyaspossible. Withthisinmind,wehaveundertakenseveralchangesinorganization:
◦ Anewchapterontherelationalmodel(Chapter2)precedes SQL,laying theconceptualfoundation,withoutgettinglostindetailsofrelational algebra.
◦ Chapters3,4,and5providedetailedcoverageof SQL.Thesechaptersalso discussvariantssupportedbydifferentdatabasesystems,tominimize problemsthatstudentsfacewhentheyexecutequeriesonactualdatabase systems.Thesechapterscoverallaspectsof SQL,includingqueries,data definition,constraintspecification, OLAP,andtheuseof SQL fromwithin avarietyoflanguages,includingJava/JDBC.
◦ Formallanguages(Chapter6)havebeenpostponedtoafter SQL,andcan beomittedwithoutaffectingthesequencingofotherchapters.Onlyour discussionofqueryoptimizationinChapter13dependsontherelational algebracoverageofChapter6.
• Newdatabaseschema. Weadoptedanewschema,whichisbasedonuniversitydata,asarunningexamplethroughoutthebook.Thisschemais moreintuitiveandmotivatingforstudentsthantheearlierbankschema,and illustratesmorecomplexdesigntrade-offsinthedatabase-designchapters.
• Moresupportforahands-onstudentexperience. Tofacilitatefollowing ourrunningexample,welistthedatabaseschemaandthesamplerelation instancesforouruniversitydatabasetogetherinAppendixAaswellas wheretheyareusedinthevariousregularchapters.Inaddition,weprovide, onourWebsite http://www.db-book.com, SQL data-definitionstatementsforthe entireexample,alongwith SQL statementstocreateourexamplerelation instances.Thisencouragesstudents torunexamplequeriesdirectlyona databasesystemandtoexperimentwithmodifyingthosequeries.
• Revisedcoverageof E-R model. The E-R diagramnotationinChapter7has beenmodifiedtomakeitmorecompatiblewith UML.Thechapteralsomakes gooduseofthenewuniversitydatabaseschematoillustratemorecomplex designtrade-offs.
• Revisedcoverageofrelationaldesign. Chapter8nowhasamorereadable style,providinganintuitiveunderstandingoffunctionaldependenciesand normalization,beforecoveringfunctionaldependencytheory;thetheoryis motivatedmuchbetterasaresult.
• Expandedmaterialonapplicationdevelopmentandsecurity. Chapter9has newmaterialonapplicationdevelopment,mirroringrapidchangesinthe field.Inparticular,coverageofsecurityhasbeenexpanded,consideringits criticalityintoday’sinterconnectedworld,withanemphasisonpractical issuesoverabstractconcepts.
• Revisedandupdatedcoverageofdatastorage,indexingandqueryoptimization.Chapter10hasbeenupdatedwithnewtechnology,including expandedcoverageofflashmemory.
CoverageofB+ -treesinChapter11hasbeenrevisedtoreflectpractical implementations,includingcoverageofbulkloading,andthepresentation hasbeenimproved.TheB+ -treeexamplesinChapter11havenowbeen revisedwith n = 4,toavoidthespecialcaseofemptynodesthatariseswith the(unrealistic)valueof n = 3.
Chapter13hasnewmaterialonadvancedquery-optimizationtechniques.
• Revisedcoverageoftransactionmanagement. Chapter14providesfullcoverageofthebasicsforanintroductorycourse,withadvanceddetailsfollowinginChapters15and16.Chapter14hasbeenexpandedtocoverthepractical issuesintransactionmanagementfacedbydatabaseusersanddatabaseapplicationdevelopers.Thechapteralsoincludesanexpandedoverviewof topicscoveredinChapters15and16,ensuringthatevenifChapters15and16 areomitted,studentshaveabasicknowledgeoftheconceptsofconcurrency controlandrecovery.
Chapters14and15nowincludedetailedcoverageofsnapshotisolation, whichiswidelysupportedandusedtoday,includingcoverageofpotential hazardswhenusingit.
Chapter16nowhasasimplifieddescriptionofbasiclog-basedrecovery leadinguptocoverageofthe ARIES algorithm.
• Revisedandexpandedcoverageofdistributeddatabases. Wenowcover clouddatastorage,whichisgainingsignificantinterestforbusinessapplications.Cloudstorageoffersenterprisesopportunitiesforimprovedcostmanagementandincreasedstoragescalability,particularlyforWeb-based applications.Weexaminethoseadvantagesalongwiththepotentialdrawbacksandrisks.
Multidatabases,whichwereearlierintheadvancedtransactionprocessing chapter,arenowcoveredearlieraspartofthedistributeddatabasechapter.
• PostponedcoverageofobjectdatabasesandXML. Althoughobject-oriented languagesandXMLarewidelyusedoutsideofdatabases,theiruseindatabasesisstilllimited,makingthemappropriateformoreadvancedcourses, orassupplementarymaterialforanintroductorycourse.Thesetopicshave thereforebeenmovedtolaterinthebook,inChapters22and23.
• QBE,MicrosoftAccess,andDataloginanonlineappendix. Thesetopics, whichwereearlierpartofachapteron “otherrelationallanguages,” arenow coveredinonlineAppendixC.
Alltopicsnotlistedaboveareupdatedfromthefifthedition,thoughtheiroverall organizationisrelativelyunchanged.
Eachchapterhasalistofreviewterms,inadditiontoasummary,whichcanhelp readersreviewkeytopicscoveredinthechapter.
Theexercisesaredividedintotwosets: practiceexercises and exercises.The solutionsforthepracticeexercisesarepubliclyavailableontheWebsiteofthe book.Studentsareencouragedtosolvethepracticeexercisesontheirown,and laterusethesolutionsontheWebsitetochecktheirownsolutions.Solutions totheotherexercisesareavailableonlytoinstructors(see “Instructor’sNote,” below,forinformationonhowtogetthesolutions).
Manychaptershaveatoolssectionattheendofthechapterthatprovides informationonsoftwaretoolsrelatedtothetopicofthechapter;someofthese toolscanbeusedforlaboratoryexercises. SQLDDL andsampledataforthe universitydatabaseandotherrelationsusedintheexercisesareavailableonthe Websiteofthebook,andcanbeusedforlaboratoryexercises.
Instructor’sNote Thebookcontainsbothbasicandadvancedmaterial,whichmightnotbecoveredinasinglesemester.Wehavemarkedseveralsectionsasadvanced,using thesymbol “**”.Thesesectionsmaybeomittedifsodesired,withoutalossof continuity.Exercisesthataredifficult(andcanbeomitted)arealsomarkedusing thesymbol “**” . Itispossibletodesigncoursesbyusingvarioussubsetsofthechapters.Some ofthechapterscanalsobecoveredinanorderdifferentfromtheirorderinthe book.Weoutlinesomeofthepossibilitieshere:
• Chapter5(Advanced SQL)canbeskippedordeferredtolaterwithoutlossof continuity.WeexpectmostcourseswillcoveratleastSection5.1.1early,as JDBC islikelytobeausefultoolinstudentprojects.
• Chapter6(FormalRelationalQueryLanguages)canbecoveredimmediately afterChapter2,aheadof SQL.Alternatively,thischaptermaybeomittedfrom anintroductorycourse.
WerecommendcoveringSection6.1(relationalalgebra)ifthecoursealso coversqueryprocessing.However,Sections6.2and6.3canbeomittedif studentswillnotbeusingrelationalcalculusaspartofthecourse.
• Chapter7(E-R Model)canbecoveredaheadofChapters3,4and5ifyouso desire,sinceChapter7doesnothaveanydependencyon SQL.
• Chapter13(QueryOptimization)canbeomittedfromanintroductorycourse withoutaffectingcoverageofanyotherchapter.
• Bothourcoverageoftransactionprocessing(Chapters14through16)and ourcoverageofsystemarchitecture(Chapters17through19)consistofan overviewchapter(Chapters14and17,respectively),followedbychapters withdetails.YoumightchoosetouseChapters14and17,whileomitting Chapters15,16,18and19,ifyoudefertheselatterchapterstoanadvanced course.
• Chapters20and21,coveringdatawarehousing,datamining,andinformationretrieval,canbeusedasself-studymaterialoromittedfromanintroductorycourse.
• Chapters22(Object-BasedDatabases),and23(XML)canbeomittedfroman introductorycourse.
• Chapters24through26,coveringadvancedapplicationdevelopment,spatial, temporalandmobiledata,andadvancedtransactionprocessing,aresuitable foranadvancedcourseorforself-studybystudents.
• Thecase-studyChapters27through30aresuitableforself-studybystudents. Alternatively,theycanbeusedasanillustrationofconceptswhentheearlier chaptersarepresentedinclass.
Modelcoursesyllabi,basedonthetext,canbefoundontheWebsiteofthebook.
WebSiteandTeachingSupplements AWebsiteforthebookisavailableatthe URL: http://www.db-book.com.TheWeb sitecontains:
• Slidescoveringallthechaptersofthebook.
• Answerstothepracticeexercises.
• Thefiveappendices.
• Anup-to-dateerratalist.
• Laboratorymaterial,including SQLDDL andsampledatafortheuniversity schemaandotherrelationsusedinexercises,andinstructionsforsettingup andusingvariousdatabasesystemsandtools.
Thefollowingadditionalmaterialisavailableonlytofaculty:
• Aninstructormanualcontainingsolutionstoallexercisesinthebook.
• Aquestionbankcontainingextraexercises.
Formoreinformationabouthowtogetacopyoftheinstructormanualandthe questionbank,pleasesendelectronicmailtocustomer.service@mcgraw-hill.com. IntheUnitedStates,youmaycall800-338-3987.TheMcGraw-HillWebsitefor thisbookis http://www.mhhe.com/silberschatz.
ContactingUs Wehaveendeavoredtoeliminatetypos,bugs,andthelikefromthetext.But,as innewreleasesofsoftware,bugsalmostsurelyremain;anup-to-dateerratalist isaccessiblefromthebook’sWebsite.Wewouldappreciateitifyouwouldnotify usofanyerrorsoromissionsinthebookthatarenotonthecurrentlistoferrata.
Wewouldbegladtoreceivesuggestionsonimprovementstothebook.We alsowelcomeanycontributionstothebookWebsitethatcouldbeofuseto otherreaders,suchasprogrammingexercises,projectsuggestions,onlinelabs andtutorials,andteachingtips.
Emailshouldbeaddressedto db-book-authors@cs.yale.edu.AnyothercorrespondenceshouldbesenttoAviSilberschatz,DepartmentofComputerScience, YaleUniversity,51ProspectStreet,P.O.Box208285,NewHaven,CT06520-8285 USA.
Acknowledgments Manypeoplehavehelpeduswiththissixthedition,aswellaswiththeprevious fiveeditionsfromwhichitisderived.
SixthEdition • AnastassiaAilamaki,SaileshKrishnamurthy,SpirosPapadimitriou,and BiancaSchroeder(CarnegieMellonUniversity)forwritingChapter27describingthe PostgreSQL databasesystem.
• HakanJakobsson(Oracle),forwritingChapter28ontheOracledatabase system.
• SriramPadmanabhan(IBM),forwritingChapter29describingthe IBMDB2 databasesystem.
• SameetAgarwal,Jos ´ eA.Blakeley,ThierryD’Hers,GeraldHinson,DirkMyers,VaqarPirzada,BillRamos,BalajiRathakrishnan,MichaelRys,Florian Waas,andMichaelZwilling(allofMicrosoft)forwritingChapter30describingtheMicrosoft SQLServerdatabasesystem,andinparticularJos ´ e Blakeleyforcoordinatingandeditingthechapter;C ´ esarGalindo-Legaria, GoetzGraefe,KalenDelaney,andThomasCasey(allofMicrosoft)fortheir contributionstothepreviouseditionoftheMicrosoft SQLServerchapter.
• DanielAbadiforreviewingthetableofcontentsofthefiftheditionand helpingwiththeneworganization.
• SteveDolins,UniversityofFlorida;RolandoFernanez,GeorgeWashington University;FrantisekFranek,McMasterUniversity;LatifurKhan,University ofTexas-Dallas;SanjayMadria,UniversityofMissouri-Rolla;ArisOuksel, UniversityofIllinois;andRichardSnodgrass,UniversityofWaterloo;who servedasreviewersofthebookandwhosecommentshelpedusgreatlyin formulatingthissixthedition.
• JudiPaigeforherhelpingeneratingfiguresandpresentationslides.
• MarkWogahnformakingsurethatthesoftwaretoproducethebook,includingLaTeXmacrosandfonts,workedproperly.
• N.L.Sardaforfeedbackthathelpedusimproveseveralchapters,inparticular Chapter11;VikramPudiformotivatingustoreplacetheearlierbankschema; andShetalShahforfeedbackonseveralchapters.
• StudentsatYale,Lehigh,and IIT Bombay,fortheircommentsonthefifth edition,aswellasonpreprintsofthesixthedition.
PreviousEditions • ChenLiandSharadMehrotraforprovidingmaterialon JDBC andsecurity forthefifthedition.
• MarilynTurnamianandNandprasadJoshiprovidedsecretarialassistancefor thefifthedition,andMarilynalsopreparedanearlydraftofthecoverdesign forthefifthedition.
• LynDupr ´ ecopyeditedthethirdeditionandSaraStrandtmaneditedthetext ofthethirdedition.
• NileshDalvi,SumitSanghai,GauravBhalotia,ArvindHulgeriK.V.Raghavan,PrateekKapadia,SaraStrandtman,GregSpeegle,andDawnBezviner helpedtopreparetheinstructor’smanualforearliereditions.
• Theideaofusingshipsaspartofthecoverconceptwasoriginallysuggested tousbyBruceStephan.
• Thefollowingpeoplepointedouterrorsinthefifthedition:AlexComan, RavindraGuravannavar,ArvindHulgeri,RohitKulshreshtha,Sang-Won Lee,JoeH.C.Lu,AlexN.Napitupulu,H.K.Park,JianPei,FernandoSaenz Perez,DonniePinkston,YmaPinto,RajarshiRakshit,SandeepSatpal,Amon Seagull,BarrySoroka,PraveenRanjanSrivastava,HansSvensson,Moritz Wiese,andEyobDeleleYirdaw.
• Thefollowingpeopleofferedsuggestionsandcommentsforthefifthandearliereditionsofthebook.R.B.Abhyankar,HaniAbu-Salem,JamelR.Alsabbagh,RajAshar,DonBatory,PhilBernhard,ChristianBreimann,GavinM. Bierman,JanekBogucki,HaranBoral,PaulBourgeois,PhilBohannon,Robert Brazile,YuriBreitbart,RamziBualuan,MichaelCarey,SoumenChakrabarti, TomChappell,ZhengxinChen,Y.C.Chin,JanChomicki,LaurensDamen, PrasannaDhandapani,QinDing,ValentinDinu,J.Edwards,ChristosFaloutsos,HommaFarian,AlanFekete,FrantisekFranek,ShashiGadia,Hector Garcia-Molina,GoetzGraefe,JimGray,LeGruenwald,EitanM.Gurari, WilliamHankley,BruceHillyer,RonHitchens,ChadHogg,ArvindHulgeri, YannisIoannidis,ZhengJiaping,RandyM.Kaplan,GrahamJ.L.Kemp,Rami Khouri,Hyoung-JooKim,WonKim,HenryKorth(fatherofHenryF.),Carol Kroll,HaeChoonLee,Sang-WonLee,IrwinLevinstein,MarkLlewellyn, GaryLindstrom,LingLiu,DaveMaier,KeithMarzullo,MartyMaskarinec, FletcherMattox,SharadMehrotra,JimMelton,AlbertoMendelzon,Ami Motro,BhagirathNarahari,Yiu-KaiDennisNg,Thanh-DuyNguyen,Anil Nigam,CyrilOrji,MeralOzsoyoglu,D.B.Phatak,JuanAltmayerPizzorno, BrucePorter,SunilPrabhakar,JimPeterson,K.V.Raghavan,NahidRahman, RajarshiRakshit,KrithiRamamritham,MikeReiter,GregRiccardi,Odinaldo Rodriguez,MarkRoth,MarekRusinkiewicz,MichaelRys,SunitaSarawagi, N.L.Sarda,PatrickSchmid,NikhilSethi,S.Seshadri,StewartShen,Shashi Shekhar,AmitSheth,MaxSmolens,NanditSoparkar,GregSpeegle,Jeff Storey,DilysThomas,PremThomas,TimWahls,AnitaWhitehall,ChristopherWilson,MarianneWinslett,WeiningZhang,andLiuZhenming.
BookProduction ThepublisherwasRaghuSrinivasan.ThedevelopmentaleditorwasMelinda D.Bilecki.TheprojectmanagerwasMelissaLeick.Themarketingmanagerwas
CurtReynolds.TheproductionsupervisorwasLauraFuller.Thebookdesigner wasBrendaRolwes.ThecoverdesignerwasStudioMontage,St.Louis,Missouri. ThecopyeditorwasGeorgeWatson.TheproofreaderwasKevinCampbell.The freelanceindexerwasTobiahWaldron.TheAptarateamconsistedofRaman AroraandSudeshnaNandy
PersonalNotes Sudarshanwouldliketoacknowledgehiswife,Sita,forherloveandsupport, andchildrenMadhurandAdvaithfortheirloveandjoiedevivre.Hankwould liketoacknowledgehiswife,Joan,andhischildren,AbbyandJoe,fortheirlove andunderstanding.AviwouldliketoacknowledgeValerieforherlove,patience, andsupportduringtherevisionofthisbook.
A.S.
H.F.K.
S.S.
CHAPTER 1 Introduction A database-managementsystem(DBMS) isacollectionofinterrelateddataand asetofprogramstoaccessthosedata.Thecollectionofdata,usuallyreferredto asthe database,containsinformationrelevanttoanenterprise.Theprimarygoal ofa DBMS istoprovideawaytostoreandretrievedatabaseinformationthatis both convenient and efficient.
Databasesystemsaredesignedtomanagelargebodiesofinformation.Managementofdatainvolvesbothdefiningstructuresforstorageofinformation andprovidingmechanismsforthemanipulationofinformation.Inaddition,the databasesystemmustensurethesafetyoftheinformationstored,despitesystem crashesorattemptsatunauthorizedaccess.Ifdataaretobesharedamongseveral users,thesystemmustavoidpossibleanomalousresults.
Becauseinformationissoimportantinmostorganizations,computerscientistshavedevelopedalargebodyofconceptsandtechniquesformanagingdata. Theseconceptsandtechniquesformthefocusofthisbook.Thischapterbriefly introducestheprinciplesofdatabasesystems.
1.1 Database-SystemApplications Databasesarewidelyused.Herearesomerepresentativeapplications:
• EnterpriseInformation
◦ Sales:Forcustomer,product,andpurchaseinformation.
◦ Accounting:Forpayments,receipts,accountbalances,assetsandother accountinginformation.
◦ Humanresources:Forinformationaboutemployees,salaries,payrolltaxes, andbenefits,andforgenerationofpaychecks.
◦ Manufacturing:Formanagementofthesupplychainandfortrackingproductionofitemsinfactories,inventoriesofitemsinwarehousesandstores, andordersforitems.
◦ Onlineretailers:Forsalesdatanotedaboveplusonlineordertracking, generationofrecommendationlists,andmaintenanceofonlineproduct evaluations.
• BankingandFinance
◦ Banking:Forcustomerinformation,accounts,loans,andbankingtransactions.
◦ Creditcardtransactions:Forpurchasesoncreditcardsandgenerationof monthlystatements.
◦ Finance:Forstoringinformationaboutholdings,sales,andpurchasesof financialinstrumentssuchasstocksandbonds;alsoforstoringreal-time marketdatatoenableonlinetradingbycustomersandautomatedtrading bythefirm.
• Universities:Forstudentinformation,courseregistrations,andgrades(in additiontostandardenterpriseinformationsuchashumanresourcesand accounting).
• Airlines:Forreservationsandscheduleinformation.Airlineswereamongthe firsttousedatabasesinageographicallydistributedmanner.
• Telecommunication:Forkeepingrecordsofcallsmade,generatingmonthly bills,maintainingbalancesonprepaidcallingcards,andstoringinformation aboutthecommunicationnetworks.
Asthelistillustrates,databasesformanessentialpartofeveryenterprisetoday, storingnotonlytypesofinformationthatarecommontomostenterprises,but alsoinformationthatisspecifictothecategoryoftheenterprise.
Overthecourseofthelastfourdecadesofthetwentiethcentury,useof databasesgrewinallenterprises.Intheearlydays,veryfewpeopleinteracteddirectlywithdatabasesystems,althoughwithoutrealizingit,theyinteractedwith databasesindirectly—throughprintedreportssuchascreditcardstatements,or throughagentssuchasbanktellersandairlinereservationagents.Thenautomatedtellermachinescamealongandletusersinteractdirectlywithdatabases. Phoneinterfacestocomputers(interactivevoice-responsesystems)alsoallowed userstodealdirectlywithdatabases—acallercoulddialanumber,andpress phonekeystoenterinformationortoselectalternativeoptions,tofindflight arrival/departuretimes,forexample,ortoregisterforcoursesinauniversity.
TheInternetrevolutionofthelate1990ssharplyincreaseddirectuseraccessto databases.Organizationsconvertedmanyoftheirphoneinterfacestodatabases intoWebinterfaces,andmadeavarietyofservicesandinformationavailable online.Forinstance,whenyouaccessanonlinebookstoreandbrowseabookor musiccollection,youareaccessingdatastoredinadatabase.Whenyouenteran orderonline,yourorderisstoredinadatabase.WhenyouaccessabankWebsite andretrieveyourbankbalanceandtransactioninformation,theinformationis retrievedfromthebank’sdatabasesystem.WhenyouaccessaWebsite,informa-
tionaboutyoumayberetrievedfromadatabasetoselectwhichadvertisements youshouldsee.Furthermore,dataaboutyourWebaccessesmaybestoredina database.
Thus,althoughuserinterfaceshidedetailsofaccesstoadatabase,andmost peoplearenotevenawaretheyaredealingwithadatabase,accessingdatabases formsanessentialpartofalmosteveryone’slifetoday.
Theimportanceofdatabasesystemscanbejudgedinanotherway—today, databasesystemvendorslikeOracleareamongthelargestsoftwarecompanies intheworld,anddatabasesystemsformanimportantpartoftheproductlineof Microsoftand IBM.
1.2 PurposeofDatabaseSystems Databasesystemsaroseinresponsetoearlymethodsofcomputerizedmanagementofcommercialdata.Asanexampleofsuchmethods,typicalofthe1960s, considerpartofauniversityorganizationthat,amongotherdata,keepsinformationaboutallinstructors,students,departments,andcourseofferings.One waytokeeptheinformationonacomputeristostoreitinoperatingsystem files.Toallowuserstomanipulatetheinformation,thesystemhasanumberof applicationprogramsthatmanipulatethefiles,includingprogramsto:
• Addnewstudents,instructors,andcourses
• Registerstudentsforcoursesandgenerateclassrosters
• Assigngradestostudents,computegradepointaverages(GPA),andgenerate transcripts
Systemprogrammerswrotetheseapplicationprogramstomeettheneedsofthe university.
Newapplicationprogramsareaddedtothesystemastheneedarises.For example,supposethatauniversitydecidestocreateanewmajor(say,computer science).Asaresult,theuniversitycreatesanewdepartmentandcreatesnewpermanentfiles(oraddsinformationtoexistingfiles)torecordinformationaboutall theinstructorsinthedepartment,studentsinthatmajor,courseofferings,degree requirements,etc.Theuniversitymayhavetowritenewapplicationprograms todealwithrulesspecifictothenewmajor.Newapplicationprogramsmayalso havetobewrittentohandlenewrulesintheuniversity.Thus,astimegoesby, thesystemacquiresmorefilesandmoreapplicationprograms.
Thistypical file-processingsystem issupportedbyaconventionaloperatingsystem.Thesystemstorespermanentrecordsinvariousfiles,anditneeds differentapplicationprogramstoextractrecordsfrom,andaddrecordsto,theappropriatefiles.Beforedatabasemanagementsystems(DBMSs)wereintroduced, organizationsusuallystoredinformationinsuchsystems.
Keepingorganizationalinformationinafile-processingsystemhasanumber ofmajordisadvantages:
• Dataredundancyandinconsistency.Sincedifferentprogrammerscreate thefilesandapplicationprogramsoveralongperiod,thevariousfilesare likelytohavedifferentstructuresandtheprogramsmaybewritteninseveral programminglanguages.Moreover,thesameinformationmaybeduplicated inseveralplaces(files).Forexample,ifastudenthasadoublemajor(say, musicandmathematics)theaddressandtelephonenumberofthatstudent mayappearinafilethatconsistsofstudentrecordsofstudentsintheMusic departmentandinafilethatconsistsofstudentrecordsofstudentsinthe Mathematicsdepartment.Thisredundancyleadstohigherstorageandaccess cost.Inaddition,itmayleadto datainconsistency;thatis,thevariouscopies ofthesamedatamaynolongeragree.Forexample,achangedstudentaddress maybereflectedintheMusicdepartmentrecordsbutnotelsewhereinthe system.
• Difficultyinaccessingdata.Supposethatoneoftheuniversityclerksneeds tofindoutthenamesofallstudentswholivewithinaparticularpostal-code area.Theclerkasksthedata-processingdepartmenttogeneratesuchalist. Becausethedesignersoftheoriginalsystemdidnotanticipatethisrequest, thereisnoapplicationprogramonhandtomeetit.Thereis,however,an applicationprogramtogeneratethelistof all students.Theuniversityclerk hasnowtwochoices:eitherobtainthelistofallstudentsandextractthe neededinformationmanuallyoraskaprogrammertowritethenecessary applicationprogram.Bothalternativesareobviouslyunsatisfactory.Suppose thatsuchaprogramiswritten,andthat,severaldayslater,thesameclerk needstotrimthatlisttoincludeonlythosestudentswhohavetakenatleast 60credithours.Asexpected,aprogramtogeneratesuchalistdoesnot exist.Again,theclerkhastheprecedingtwooptions,neitherofwhichis satisfactory.
Thepointhereisthatconventionalfile-processingenvironmentsdonot allowneededdatatoberetrievedinaconvenientandefficientmanner.More responsivedata-retrievalsystemsarerequiredforgeneraluse.
• Dataisolation.Becausedataarescatteredinvariousfiles,andfilesmay beindifferentformats,writingnewapplicationprogramstoretrievethe appropriatedataisdifficult.
• Integrityproblems.Thedatavaluesstoredinthedatabasemustsatisfycertaintypesof consistencyconstraints.Supposetheuniversitymaintainsan accountforeachdepartment,andrecordsthebalanceamountineachaccount.Supposealsothattheuniversity requiresthattheaccountbalanceofa departmentmayneverfallbelowzero.Developersenforcetheseconstraints inthesystembyaddingappropriatecodeinthevariousapplicationprograms.However,whennewconstraintsareadded,itisdifficulttochange theprogramstoenforcethem.Theproblemiscompoundedwhenconstraints involveseveraldataitemsfromdifferentfiles.
• Atomicityproblems.Acomputersystem,likeanyotherdevice,issubject tofailure.Inmanyapplications,itiscrucialthat,ifafailureoccurs,thedata
berestoredtotheconsistentstatethat existedpriortothefailure.Consider aprogramtotransfer$500fromtheaccountbalanceofdepartment A to theaccountbalanceofdepartment B.Ifasystemfailureoccursduringthe executionoftheprogram,itispossiblethatthe$500wasremovedfromthe balanceofdepartment A butwasnotcreditedtothebalanceofdepartment B, resultinginaninconsistentdatabasestate.Clearly,itisessentialtodatabase consistencythateitherboththecreditanddebitoccur,orthatneitheroccur. Thatis,thefundstransfermustbe atomic —itmusthappeninitsentiretyor notatall.Itisdifficulttoensureatomicityinaconventionalfile-processing system.
• Concurrent-accessanomalies.Forthesakeofoverallperformanceofthesystemandfasterresponse,manysystemsallowmultipleuserstoupdatethe datasimultaneously.Indeed,today,thelargestInternetretailersmayhave millionsofaccessesperdaytotheirdatabyshoppers.Insuchanenvironment,interactionofconcurrentupdatesispossibleandmayresultininconsistentdata.Considerdepartment A,withanaccountbalanceof$10,000.If twodepartmentclerksdebittheaccountbalance(bysay$500and$100,respectively)ofdepartment A atalmostexactlythesametime,theresultofthe concurrentexecutionsmayleavethebudgetinanincorrect(orinconsistent) state.Supposethattheprogramsexecutingonbehalfofeachwithdrawalread theoldbalance,reducethatvaluebytheamountbeingwithdrawn,andwrite theresultback.Ifthetwoprogramsrunconcurrently,theymaybothreadthe value$10,000,andwriteback$9500and$9900,respectively.Dependingon whichonewritesthevaluelast,theaccountbalanceofdepartment A may containeither$9500or$9900,ratherthanthecorrectvalueof$9400.Toguard againstthispossibility,thesystemmustmaintainsomeformofsupervision. Butsupervisionisdifficulttoprovidebecausedatamaybeaccessedbymany differentapplicationprogramsthathavenotbeencoordinatedpreviously.
Asanotherexample,supposearegistrationprogrammaintainsacountof studentsregisteredforacourse,inordertoenforcelimitsonthenumberof studentsregistered.Whenastudentregisters,theprogramreadsthecurrent countforthecourses,verifiesthatthecountisnotalreadyatthelimit,adds onetothecount,andstoresthecountbackinthedatabase.Supposetwo studentsregisterconcurrently,withthecountat(say)39.Thetwoprogram executionsmaybothreadthevalue39,andbothwouldthenwriteback40, leadingtoanincorrectincreaseofonly1,eventhoughtwostudentssuccessfullyregisteredforthecourseandthecountshouldbe41.Furthermore, supposethecourseregistrationlimitwas40;intheabovecasebothstudents wouldbeabletoregister,leadingtoaviolationofthelimitof40students.
• Securityproblems.Noteveryuserofthedatabasesystemshouldbeable toaccessallthedata.Forexample,inauniversity,payrollpersonnelneed toseeonlythatpartofthedatabasethathasfinancialinformation.Theydo notneedaccesstoinformationaboutacademicrecords.But,sinceapplicationprogramsareaddedtothefile-processingsysteminanadhocmanner, enforcingsuchsecurityconstraintsisdifficult.
Thesedifficulties,amongothers,promptedthedevelopmentofdatabasesystems.Inwhatfollows,weshallseetheconceptsandalgorithmsthatenable databasesystemstosolvetheproblemswithfile-processingsystems.Inmostof thisbook,weuseauniversityorganizationasarunningexampleofatypical data-processingapplication.
1.3 ViewofData Adatabasesystemisacollectionofinterrelateddataandasetofprogramsthat allowuserstoaccessandmodifythesedata.Amajorpurposeofadatabase systemistoprovideuserswithan abstract viewofthedata.Thatis,thesystem hidescertaindetailsofhowthedataarestoredandmaintained.
1.3.1DataAbstraction Forthesystemtobeusable,itmustretrievedataefficiently.Theneedforefficiency hasleddesignerstousecomplexdatastructurestorepresentdatainthedatabase. Sincemanydatabase-systemusersarenotcomputertrained,developershidethe complexityfromusersthroughseverallevelsofabstraction,tosimplifyusers’ interactionswiththesystem:
• Physicallevel.Thelowestlevelofabstractiondescribes how thedataareactuallystored.Thephysicalleveldescribescomplexlow-leveldatastructures indetail.
• Logicallevel.Thenext-higherlevelofabstractiondescribes what dataare storedinthedatabase,andwhatrelationshipsexistamongthosedata.The logicallevelthusdescribestheentiredatabaseintermsofasmallnumberof relativelysimplestructures.Although implementationofthesimplestructuresatthelogicallevelmayinvolvecomplexphysical-levelstructures,the userofthelogicalleveldoesnotneedtobeawareofthiscomplexity.This isreferredtoas physicaldataindependence.Databaseadministrators,who mustdecidewhatinformationtokeepinthedatabase,usethelogicallevel ofabstraction.
• Viewlevel.Thehighestlevelofabstractiondescribesonlypartoftheentire database.Eventhoughthelogicallevelusessimplerstructures,complexity remainsbecauseofthevarietyofinformationstoredinalargedatabase. Manyusersofthedatabasesystemdonotneedallthisinformation;instead, theyneedtoaccessonlyapartofthedatabase.Theviewlevelofabstraction existstosimplifytheirinteractionwiththesystem.Thesystemmayprovide manyviewsforthesamedatabase.
Figure1.1showstherelationshipamongthethreelevelsofabstraction. Ananalogytotheconceptofdatatypesinprogramminglanguagesmay clarifythedistinctionamonglevelsofabstraction.Manyhigh-levelprogramming
view level
view 1view 2 logical level physical level
view n …
Figure1.1 Thethreelevelsofdataabstraction.
languagessupportthenotionofastructuredtype.Forexample,wemaydescribe arecordasfollows:1
type instructor = record
ID : char (5); name : char (20); dept name : char (20); salary : numeric (8,2); end;
Thiscodedefinesanewrecordtypecalled instructor withfourfields.Eachfield hasanameandatypeassociatedwithit.Auniversityorganizationmayhave severalsuchrecordtypes,including
• department,withfields dept name, building,and budget
• course,withfields course id, title, dept name,and credits
• student,withfields ID, name, dept name,and tot cred
Atthephysicallevel,an instructor, department,or student recordcanbedescribedasablockofconsecutivestoragelocations.Thecompilerhidesthislevel ofdetailfromprogrammers.Similarly,thedatabasesystemhidesmanyofthe lowest-levelstoragedetailsfromdatabaseprogrammers.Databaseadministrators,ontheotherhand,maybeawareofcertaindetailsofthephysicalorganizationofthedata.
1 Theactualtypedeclarationdependsonthelanguagebeingused.CandC++use struct declarations.Javadoesnothave suchadeclaration,butasimpleclasscanbedefinedtothesameeffect.
Atthelogicallevel,eachsuchrecordisdescribedbyatypedefinition,as inthepreviouscodesegment,andtheinterrelationshipoftheserecordtypesis definedaswell.Programmersusingaprogramminglanguageworkatthislevel ofabstraction.Similarly,databaseadministratorsusuallyworkatthislevelof abstraction.
Finally,attheviewlevel,computerusersseeasetofapplicationprograms thathidedetailsofthedatatypes.Attheviewlevel,severalviewsofthedatabase aredefined,andadatabaseuserseessomeoralloftheseviews.Inaddition tohidingdetailsofthelogicallevelofthedatabase,theviewsalsoprovidea securitymechanismtopreventusersfromaccessingcertainpartsofthedatabase. Forexample,clerksintheuniversityregistrarofficecanseeonlythatpartofthe databasethathasinformationaboutstudents;theycannotaccessinformation aboutsalariesofinstructors.
1.3.2InstancesandSchemas Databaseschangeovertimeasinformationisinsertedanddeleted.Thecollection ofinformationstoredinthedatabaseataparticularmomentiscalledan instance ofthedatabase.Theoveralldesignofthedatabaseiscalledthedatabase schema. Schemasarechangedinfrequently,ifatall.
Theconceptofdatabaseschemasandinstancescanbeunderstoodbyanalogy toaprogramwritteninaprogramminglanguage.Adatabaseschemacorresponds tothevariabledeclarations(alongwithassociatedtypedefinitions)inaprogram. Eachvariablehasaparticularvalueatagiveninstant.Thevaluesofthevariables inaprogramatapointintimecorrespondtoan instance ofadatabaseschema.
Databasesystemshaveseveralschemas,partitionedaccordingtothelevels ofabstraction.The physicalschema describesthedatabasedesignatthephysical level,whilethe logicalschema describesthedatabasedesignatthelogicallevel. Adatabasemayalsohaveseveralschemasattheviewlevel,sometimescalled subschemas,thatdescribedifferentviewsofthedatabase.
Ofthese,thelogicalschemaisbyfarthemostimportant,intermsofitseffect onapplicationprograms,sinceprogrammersconstructapplicationsbyusingthe logicalschema.Thephysicalschemaishiddenbeneaththelogicalschema,andcan usuallybechangedeasilywithoutaffectingapplicationprograms.Application programsaresaidtoexhibit physicaldataindependence iftheydonotdepend onthephysicalschema,andthusneednotberewrittenifthephysicalschema changes.
Westudylanguagesfordescribingschemasafterintroducingthenotionof datamodelsinthenextsection.
1.3.3DataModels Underlyingthestructureofadatabaseisthe datamodel:acollectionofconceptual toolsfordescribingdata,datarelationships,datasemantics,andconsistency constraints.Adatamodelprovidesawaytodescribethedesignofadatabaseat thephysical,logical,andviewlevels.