DATABASE SYSTEM CONCEPTS HENRY F. KORTH ABRAHAM SILBERSCHATZ University of Texas at Austin McGraw-Hill, Inc. New York St. Louis San Francisco Auckland Bogota Caracas Lisbon London Madrid Mexico Milan Montreal New Delhi Paris San Juan Singapore Sydney Tokyo Toronto
Contents Preface xiü Chapter 1 Introduction 1.1 Purpose of Database Systems 1 1.2 Data Abstraction 4 1.3 Data Models 6 1.4 Instances and Schemes 11 1.5 Data Independence 12 1.6 Data Definition Language 12 1.7 Data Manipulation Language 13 1.8 Database Manager 13 1.9 Database Administrator 15 1.10 Database Users 16 1.11 Overall System Structure 17 1.12 18 20 20 Chapter 2 Entity-Relationship Model 2.1 Entities and Entity Sets 23 2.2 Relationships and Relationship Sets 24 2.3 Attributes 27 2.4 Mapping Constraints 28 2.5 Keys 30 2.6 Entity-Relationship Diagram 34 2.7 Reducing E-R Diagrams to Tables 36 2.8 Generalization 41 2.9 Aggregation 43 2.10 Design of an E-R Database Scheme 44 2.11 48 49 50 vii
viii Contents Chapter 3 Relational Model 3.1 Structure of Relational Databases 53 3.2 The Relational Algebra 60 3.3 The Tuple Relational Calculus 75 3.4 The Domain Relational Calculus 81 3.5 Modifying the Database 85 3.6 Views 87 3.7 91 91 95 Chapter 4 Relational Commercial Languages 4.1 SQL 97 4.2 Query-by-Example 121 4.3 Quel 134 4.4 144 145 148 Chapter 5 Integrity Constraints 5.1 Domain Constraints 149 5.2 Referential Integrity 151 5.3 Functional Dependencies 155 5.4 Assertions 164 5.5 Triggers 165 5.6 166 167 169 Chapter 6 Relational Database Design 6.1 Pitfalls in Relational Database Design 173 6.2 Normalization Using Functional Dependencies 180 6.3 Normalization Using Multivalued Dependencies 192 6.4 Normalization Using Join Dependencies 200 6.5 Domain-Key Normal Form 204 6.6 Alternative Approaches to Database Design 206 6.7 209 210 213 Chapter 7 File and System Structure 7.1 Overall System Structure 215 7.2 Physical Storage Media 217
Contents 7.3 File Organization 221 7.4 Organization of Records into Blocks 227 7.5 Sequential Files 231 7.6 Mapping Relational Data to Files 232 7.7 Data Dictionary Storage 235 7.8 Buffer Management 236 7.9 239 240 242 Chapter 8 Indexing and Hashing 8.1 Basic Concepts 245 8.2 Indexing 246 8.3 B + -Tree Index Files 253 8.4 B-Tree Index Files 259 8.5 Static Hash Functions 261 8.6 Dynamic Hash Functions 264 8.7 Comparison of Indexing and Hashing 270 8.8 Index Definition in SQL 272 8.9 Multiple-Key Access 273 8.10 277 278 279 Chapter 9 Query Processing 9.1 Query Interpretation 281 9.2 Equivalence of Expressions 282 9.3 Estimation of Query-Processing Cost 288 9.4 Estimation of Costs of Access Using Indices 290 9.5 Join Strategies 293 9.6 Join Strategies for Parallel Processors 301 9.7 Structure of the Query Optimizer 305 9.8 306 307 310 Chapter 10 Recovery and Atomicity 10.1 Failure Classification 313 10.2 The Storage Hierarchy 315 10.3 Transaction Model 317 10.4 Log-Based Recovery 323 10.5 Buffer Management 331 10.6 Checkpoints 333
x Contents 10.7 Shadow Paging 335 10.8 Failure with Loss of Nonvolatile Storage 339 10.9 Stahle Storage Implementation 340 10.10 341 343 344 Chapter 11 Concurrency Control 11.1 Schedules 347 11.2 Testing for Serializability 356 11.3 Lock-Based Protocols 365 11.4 Timestamp-Based Protocols 374 11.5 Validation Techniques 377 11.6 Multiple Granularity 379 11.7 Multiversion Schemes 383 11.8 Insert and Delete Operations 384 11.9 387 389 393 Chapter 12 Transaction Processing 12.1 Storage Model 395 12.2 Recovery from Transaction Failure 397 12.3 Deadlock Handling 402 12.4 Weak Levels of Consistency 407 12.5 High-Performance Transaction Systems 408 12.6 Concurrency in Index Structures 410 12.7 Transaction Definition in SQL 413 12.8 Long-Duration Transactions 413 12.9 420 422 422 Chapter 13 Object-Oriented Model 13.1 New Database Applications 425 13.2 Object Structure 428 13.3 Class Hierarchy 428 13.4 Multiple Inheritance 431 13.5 Object Identity 434 13.6 Object Containment 435 13.7 Physical Organization 436 13.8 Object-Oriented Queries 437
Contents xi 13.9 Scheme Modification 438 13.10 439 440 440 Chapter 14 14.1 14.2 14.3 14.4 Chapter 15 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 15.10 15.11 15.12 Chapter 16 16.1 16.2 16.3 16.4 16.5 16.6 Chapter 17 17.1 17.2 17.3 Extended Relational Systems Logic-Based Data Model The Nested Relational Model Expert Database Systems Distributed Databases Structure of Distributed Databases Trade-offs in Distributing the Database Design of Distributed Databases Transparency and Autonomy Distributed Query Processing Recovery in Distributed Systems Commit Protocols Concurrency Control Deadlock Handling Coordinator Selection Multidatabase Systems Security and Integrity Security and Integrity Violations Authorization and Views Security Specification in SQL Encryption Statistical Databases Case Studies System R Academic Ingres Commercial Systems 443 458 468 469 469 471 473 476 478 484 487 491 494 502 507 513 515 517 518 522 525 527 531 533 534 536 537 538 541 545 547
xii Contents 17.4 Microcomputer Database Systems 550 17.5 Database Programming Languages 551 554 Appendix A Network Model A.l A.2 A.3 A.4 A.5 A.6 A.7 A.8 A.9 Appendix B 1 Hierarchical Model B.l B.2 B.3 B.4 B.5 B.6 B.7 B.8 Basic Concepts Data-Structure Diagrams The DBTG CODASYL Model DBTG Data Retrieval Facility DBTG Update Facility DBTG Set-Processing Facility Mapping Networks to Files Network Systems Basic Concepts Tree-Structure Diagrams Data Retrieval Facility Update Facility Virtual Records Mapping Hierarchies to Files Hierarchical Systems Bibliography 555 556 563 569 577 580 585 590 591 592 595 597 598 610 616 619 621 623 625 627 630 631 Index 679