220 likes | 333 Views
Foundations of Relational Implementation (1). IS 240 – Database Management Lecture #13 – 2004-04-01 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu. Topics. Review of Relational Terminology Define DB Using DDL Allocate Disk Space Plan for Maintenance Loading the DB
E N D
Foundations of Relational Implementation (1) IS 240 – Database Management Lecture #13 – 2004-04-01Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu
Topics • Review of Relational Terminology • Define DB Using DDL • Allocate Disk Space • Plan for Maintenance • Loading the DB • DML Interfaces
Review of Relational Terminology • Relation / table / file / dataset • Tuple / row / record / entry • Attribute / column / field • Domain • Uniqueness
Key – Two Meanings • Design: unique identifier(s) of row • Implementation: performance tool • Logical key: unique identifier • Physical key: column with an index for faster performance
Indexes • Kroenke reserves word “key” for logical key • Uses word “index” for physical key • Indexes are useful • Find rows fast • Retrieve rows in a sorted order • Enforce uniqueness
Example of Indexes in a Database * 1 block • Compare # I/Os required to read all the order #9890 • Without index • With index on OrdNo • With packing* on index
Implementing RDB • Having designed a DB using the relational model, there’s no problem in defining a DB using today’s DBMS products • Use the Data Definition Language (DDL) of the DBMS • Formalized language for describing what we need • Varies a bit from DBMS to DBMS • Easy to learn once you’re mastered any one of them
Define DB Using DDL • Text-file (schema) DDL • Specific syntax • Name all the elements • Name all the tables • Name all the indexes and links • Graphical systems • MS-Access uses tables and also graphics • Easy to define details using text • Structures can be linked using graphics • Menus provide guidance, limits
Allocate Disk Space • PC-based products generally allocate space dynamically • DB grows as needed • Don’t have to worry about defining maximum size • Mainframe / server DBs generally require size definitions • Need to reserve space in advance • Performance issues become important • Multiple disk drives or controllers • Try to avoid thrashing of disk heads
DB Performance Issues • Computer system performance always depends on 5 factors • Access to & speed of CPU • Access to & speed of RAM • Amount & speed of disk I/O • Communications speed • Application design • DB performance often affected by • Presence / absence of indexes • Good / bad packing of records • Locking strategies (coming in later lecture)
Plan for Maintenance • Databases often central components of production systems • Plan for • Backups • Diagnostics to find corrupted data • Child records without parents • Record counters that are incorrect • Pointers to non-existent records • Data that violate business rules • Archiving inactive records • Compaction of data files
Loading the DB • Have to get data somewhere • Most DBs get historical data • Older DBs • Special programs written to read old DB, write into new DB with correct format • Often get exceptions – write to exception file • May have large-scale data entry from paper records – need careful verification • Some critical systems use dual data entry • Compare records
Types of Data Manipulation Languages (DMLs) • Relational algebra • Relational calculus • Transform-oriented languages • Graphical interfaces
Relational Algebra • Operators function on records • Union / intersection etc. • Much like set theory • Procedural language • Step-by-step changes in collections of data • Not used in commercial DBs • Useful to understand as preparation for SQL • Will study in next lesson
Relational Calculus • Non-procedural theoretical framework for dealing with relations • E.g., De Morgan's law, “The complement of a union is equal to the union of the complements." • Learned in mathematics and advanced theory of programming and data structures • Not used in commercial DB processing • Not part of this course
Transform-Oriented Languages • Non-procedural • Change relations into a single relation • Thus define conditions for selecting records and end up with a set of records that satisfy the conditions • SQL is most important example of this kind of language • Will study in detail in this course
Graphical Interfaces (1) • Query-by-Example (QBE) • User sees place to enter specific values or ranges • Generates SQL without bothering user
Graphical Interfaces (2) • Query-by-Form (QBF) • Allows more complex queries • Still generates underlying SQL
DML Interfaces to the DBMS • Forms (e.g., in MS-Access) • Query languages (e.g., SQL) • Stored procedures (incl. triggers) • API = application program interface
Homework • For Thu 8 April 2004: REQUIRED • Reread chapter 8, pp. 211-221 thoroughly using Read-Recite-Review phases of SQ3R • Do exercises 8.1-8.17 for 34 points • For next Tuesday: • Read onwards in chapter 8 from page 221 through 231 • Continue working on MS-Access lab work