+ All Categories
Home > Documents > DATABASE DESIGN AND IMPLEMENTATION - GBV

DATABASE DESIGN AND IMPLEMENTATION - GBV

Date post: 09-Feb-2022
Category:
Upload: others
View: 7 times
Download: 0 times
Share this document with a friend
5
DATABASE DESIGN AND IMPLEMENTATION Iwarä Sciore Boston College m WILEY John Wiley & Sons, Inc.
Transcript

DATABASE DESIGN AND IMPLEMENTATION

Iwarä Sciore Boston College

m WILEY

John Wiley & Sons, Inc.

Contents

HB

l I n t roduc t ion : W h y a Database System?

1.1 Databases and Database Systems 1 1.2 Record Storage 4 1.3 Multi-User Access 5 1.4 Memory Management 6 1.5 Data Models and Schemas 6 1.6 Physical Data Independence 9 1.7 Logical Data Independence 10 1.8 Chapter Summary 12 1.9 Suggested Reading 13

1.10 Exercises 13

Data Def in i t ion 17

2.1 2.2 2.3 2.4 2.5 2.6 2.7

Tables 17 Null Values 18 Keys 19 Foreign Keys and Referential Integrity 21 Ь itegrity Constraints 24 Specifying Tables in SQL 26 Chapter Summary 27

2.8 Suggested Reading 29 2.9 Exercises 29

PART 1 Relational Databases 15 Data Des ign

3.1 Designing Tables Is Difficult 32 3.2 Class Diagrams 33

31

ix

X Contents

3.3 Transforming Class Diagrams to Tables 36 3.4 The Design Process 39 3.5 Relationships as Constraints 54 3.6 Functional Dependencies and

Normalization 57 3.7 Chapter Summary 63 3.8 Suggested Reading 64 3.9 Exercises 65

Data Man ipu la t i on

4.1 Queries 70 4.2 Relational Algebra 71 4.3 SQL Queries 91 4.4 SQL Updates 109 4.5 Views 1 1 1 4.6 Chapter Summary 114 4.7 Suggested Reading 116 4.8 Exercises 117

70

In tegr i ty a n d Security ] 21

5.1 The Need for Integrity and Security 121 5.2 Assertions 122 5.3 Triggers 124 5.4 Authorization 126 5.5 Mandatory Access Control 133 5.6 Chapter Summary 135 5.7 Suggested Reading 136 5.8 Exercises 136

Imp rov ing Q u e r y Efficiency 139

6.1 The Virtues of Controlled Redundancy 139 6.2 Materialized Views 141 6.3 Indexes 148 6.4 Chapter Summary 1 58 6.5 Suggested Reading 159 6.6 Exercises 160

Clients a n d Servers 165

7.1 The Data-Sharing Problem 165 7.2 Database Clients and Servers 166 7.3 The Derby and SimpleDB Database

Servers 168 7.4 Running Database Clients 171 7.5 The Derby ij Client 1 73 7.6 The SimpleDB Version of SQL 1 74 7.7 Chapter Summary 176 7.8 Suggested Reading 176 7.9 Exercises 176

8 Using JDBC 178

8.1 Basic JDBC 178 8.2 Advanced JDBC 190 8.3 Computing in Java vs. SQL 206 8.4 Chapter Summary 209 8.5 Suggested Reading 211 8.6 Exercises 212

Persistent Java Objects 2 1 4

9.1 The Domain Model and View of a Client Program 214

9.2 The Problems with Our Domain Model 233 9.3 The Java Persistence Architecture 237 9.4 The Java Persistence Query Language 246 9.5 Downloading a JPA Implementation 253 9.6 Chapter Summary 253 9.7 Suggested Reading 255 9.8 Exercises 255

10 Data Exchange 2 5 7

PART 2 Client-Server Database Systems

163

10.1 Sharing Database Data wi th Nonusers 257 10.2 Saving Data in an XML Document 259 10.3 Restructuring an XML Document 264 10.4 Generating XML Data from the Database 276 10.5 Chapter Summary 281 10.6 Suggested Reading 282 10.7 Exercises 283

Contents X I

1 1 Webserver-Based Database Clients 286

1 Types of Database Clients 286 2 Interacting wi th a Web Server 288 3 Basic Servlet Programming 293 4 Managing Database Connections 301 5 Configuring a Servlet Container 302 6 Chapter Summary 305 7 Suggested Reading 306 8 Exercises 307

PART3

14.6 Testing Transactions 422 14.7 Chapter Summary 424 14.8 Suggested Reading 425 14.9 Exercises 426

4 3 3

Inside the Database Server 309

15 Record M a n a g e m e n t

15.1 The Record Manager 433 1 5.2 Implementing a File of Records 440 15.3 The SimpleDB Record Manager 446 15.4 Chapter Summary 462 15.5 Suggested Reading 463 15.6 Exercises 464

12 Disk a n d File M a n a g e m e n t

12.1 Persistent Data Storage 313 12.2 The Block-Level Interface to the Disk 324 12.3 The File-Level Interface to the Disk 326 12.4 The Database System and the OS 330 12.5 The SimpleDB File Manager 331 12.6 Chapter Summary 339 12.7 Suggested Reading 340 12.8 Exercises 341

16 3 ' 3 Metadata M a n a g e m e n t 467

16.1 The Metadata Manager 467 16.2 Table Metadata 469 16.3 View Metadata 473 16.4 Statistical Metadata 475 16.5 Index Metadata 480 16.6 Implementing the Metadata Manager 484 16.7 Chapter Summary 486 16.8 Suggested Reading 487 16.9 Exercises 487

13 M e m o r y M a n a g e m e n t 345

13.1 Two Principles of Database Memory Management 345

13.2 Managing Log Information 347 13.3 The SimpleDB Log Manager 349 13.4 Managing User Data 356 13.5 The SimpleDB Buffer Manager 362 13.6 Chapter Summary 372 13.7 Suggested Reading 372 13.8 Exercises 373

14 Transaction M a n a g e m e n t 376

14.1 Transactions 377 14.2 Using Transactions in SimpleDB 379 14.3 Recovery Management 381 14.4 Concurrency Management 398 14.5 Implementing SimpleDB Transactions 418

17 Query Processing

17.1 Scans 490 17.2 Update Scans 495 17.3 Implementing Scans 496 17.4 Pipelined Query Processing 504 17.5 The Cost of a Scan 506 17.6 Plans 51 1 17.7 Predicates 517 17.8 Chapter Summary 526 17.9 Suggested Reading 527

17.10 Exercises 527

18 Parsing

490

531

18.1 Syntax vs. Semantics 531 18.2 Lexical Analysis 532 18.3 Implementing the Lexical Analyzer 534

XÜ Contents

18.4 Grammars 537 18.5 Recursive-Descent Parsers 540 18.6 Adding Actions to the Parser 542 18.7 Chapter Summary 555 18.8 Suggested Reading 556 18.9 Exercises 556

19 Plann ing 561

19.1 The SimpleDB Planner 561 19.2 Verification 563 19.3 Query Planning 564 19.4 Update Planning 570 19.5 Implementing the SimpleDB Planner 572 19.6 Chapter Summary 575 19.7 Suggested Reading 576 19.8 Exercises 576

20 The Database Server

20.

5 8 0

Server Databases vs. Embedded Databases 580

20.2 Client-Server Communication 583 20.3 Implementing the Remote Interfaces 586 20.4 Implementing the JDBC Interfaces 592 20.5 Chapter Summary 595 20.6 Suggested Reading 596 20.7 Exercises 596

PART 4 Efficient Q u e r y Processing 599

21 Indexing 601

21.1 The Index Interface 601 21.2 Static Hash Indexes 605 21.3 Extendable Hash Indexes 608 21.4 B-Tree Indexes 613 21.5 Index-Aware Operator Implementations 635 21.6 Index Update Planning 641 21.7 Chapter Summary 644 21.8 Suggested Reading 645 21.9 Exercises 646

22 Mater ia l izat ion a n d Sort ing 651

22.1 The Value of Materialization 651 22.2 Temporary Tables 652 22.3 Materialization 653 22.4 Sorting 658 22.5 Grouping and Aggregation 670 22.6 Merge Joins 676 22.7 Chapter Summary 682 22.8 Suggested Reading 683 22.9 Exercises 684

23 Effective Buffer Ut i l izat ion 6 8 7

23.1 Buffer Usage in Query Plans 687 23.2 Multibuffer Sorting 688 23.3 Multibuffer Product 691 23.4 Implementing the Multibuffer Operations 692 23.5 Hash Joins 699 23.6 Comparing the Join Algorithms 703 23.7 Chapter Summary 705 23.8 Suggested Reading 706 23.9 Exercises 707

24 Query Op t im iza t ion 7 1 0

24.1 Equivalent Query Trees 71 1 24.2 The Need for Query Optimization 720 24.3 The Structure of a Query Optimizer 724 24.4 Finding the Most Promising Query Tree 725 24.5 Finding the Most Efficient Plan 737 24.6 Combining the Two Stages of

Optimization 739 24.7 Merging Query Blocks 747 24.8 Chapter Summary 748 24.9 Suggested Reading 750

24.10 Exercises 750

References 754

Index 757


Recommended