Database Models Files and models Copyright © 2003-2016 Curt Hill
Then and Now In the olden days (prior to 1980) there were three major database models Relational Hierarchical Network Each of these had commercial examples In the new millennium there are several new ones as well Copyright © 2003-2016 Curt Hill
Models Olden days More recently add: Relational Hierarchical Network Key Value Columnar Document Graph More to come? Copyright © 2003-2016 Curt Hill
File Structures In the olden days database were classified by their file structures Now we mostly hide the file structure The relational model only needs sequential files, but always uses stronger file structures Copyright © 2003-2016 Curt Hill
Indexed Files Require links between records The link is a disk address Either Cylinder, Track, Sector Or Block number The links connect the indices with their corresponding data This complicates their support Copyright © 2003-2016 Curt Hill
Index Sequential File Tree Charles Kline Roberts Zane Charles Kline Roberts Zane Abel Bag Casey Charles Able Bart Calvin Charles Dean Easy Frank Kline Larry Morris Roberts Smith Taylor Vernon Zane Easy Frank Jam Kline Leestra May Roberts Singer Smith Taylor Vernon Zane Each block should represent one disk block, such as a sector The top level contains the keys only The bottom level contains key and data We can sequentially process the bottom level to get all names We can randomly enter the tree and find any name with just two accesses Copyright © 2003-2016 Curt Hill
Relationship types Expresses the cardinality or arity of the relationship One to one One to many Many to many Copyright © 2003-2016 Curt Hill
Relational Form is that of a table Each table has Row is a record A fixed number of columns A variable number of rows Row is a record Column contains all the fields of one type Copyright © 2003-2016 Curt Hill
Relational Currently the dominant model Substantial theoretical foundation Many very popular implementations Oracle, SQLServer, Postgres, MySQL Has the most popular query language Structured Query Language (SQL) Copyright © 2003-2016 Curt Hill
Relational Picture Copyright © 2003-2016 Curt Hill
Relational Model Files Simplest theoretical file structure Collection of sequential files There are no links needed in a sequential file Implied one to one between adjacent rows This gives the DBMS the choice of how to implement Performance issues if the DBMS only uses sequential files Copyright © 2003-2016 Curt Hill
Relational Model They are fair to any view, not favoring one over the other Have the best theoretical underpinning Relational algebra and calculus Great amounts of research The only redundancy should be linking keys Copyright © 2003-2016 Curt Hill
Hierarchical Form is that of a tree Only the one to many link is allowed Typically favors one particular view of the data Least popular model Some redundancy is present because only one pointer may refer to a node IMS by IBM for mainframes, SAS Institute’s System 2000 Copyright © 2003-2016 Curt Hill
Hierarchical Model A.J. Baker 101 College St Asst. Prof Barb Jones 2401 Central Ave Assoc. Prof Hist 202 Hist 341 CS 122 CS 161 CIS 385 1028 1158 1032 1021 1026 1058 1144 1298 1036 1026 1416 1591 1428 1126 1028 Copyright © 2003-2016 Curt Hill 1416
Network Model Examples: VAX DBMS (later acquired by Oracle) Similar to hierarchical Linked objects Now allow many to many links Now possible to start in different places and still find what is needed Favors more views but not all The many links does complicate maintenance Virtually all redundancy may be eliminated with this model The links keep us from needing two copies of a key Examples: VAX DBMS (later acquired by Oracle) Copyright © 2003-2016 Curt Hill
More on Network Model The database is often organized in owner-member chains An owner is the head of chain The members are chained together The network is woven together with many such chains Instead of a object pointing at many items it points at the head of a chain of items Copyright © 2003-2016 Curt Hill
Network Model A.J. Baker 101 College St Asst. Prof Barb Jones 2401 Central Ave Assoc. Prof Hist 202 Hist 341 CS 122 CS 161 CIS 385 1028 1158 This still needs some work to redo the owner-member chains 1032 1021 1026 1058 1144 1298 1036 1026 1416 1591 1428 1126 1028 Copyright © 2003-2016 Curt Hill 1416
Weren’t There Just Three? The three models store mostly ASCII text: Numbers Strings Things that could be displayed using a typewriter There are many other types of data Graphics Audio recordings Video Copyright © 2003-2016 Curt Hill
Object-Oriented Programming Early days: data as something to be manipulated by external programs In the 80s and 90s object oriented programming paradigm became standard Now: data is part of an object Object encapsulates both the raw data and the operations used to manipulate it Data is not directly accessible Copyright © 2003-2016 Curt Hill
Object Example Automobile accelerator pedal is data Cruise control is an object Data: Velocity Position of accelerator Brake Operations: Set Coast Disable Copyright © 2003-2016 Curt Hill
Object Oriented Database Next step or not? Want to store data that DB does not know how to manipulate Not always ASCII text The solution is a program with persistent (disk based) data The problem is that this approach cuts itself off from the theory base Copyright © 2003-2016 Curt Hill
Object Relational Database Introduce object support into relational database Typical RDB may be accessed by a text based client program, as well as application programs The usual support for unusual data is the BLOB Binary Large OBject We retain the virtues of relational model But, there is very little that can be done with the BLOB, other than access Copyright © 2003-2016 Curt Hill
NoSQL No SQL or Not Only SQL Relaxation of relational DB principles Usually a key-value store Often used for the massive data sets that cause performance issues for relational and other models This group needs the theoretical foundation that relational has Will consider much later Copyright © 2003-2016 Curt Hill
Key Value Simplest model There is a key (which must be unique) linked to a group of values It gets more interesting if the values may include key value pairs as well Two examples: Riak and Reddis Copyright © 2003-2016 Curt Hill
KV Picture Copyright © 2003-2016 Curt Hill
Columnar A lot of similarity to relational, but the dominant item is the column not the row We lack rectangularity that relational has Columns are stored together Halfway between Relational and Key Value HBase, Cassandra, HyperTable are examples Copyright © 2003-2016 Curt Hill
Columnar Copyright © 2003-2016 Curt Hill
Document The basic object is now a document instead of a simple field like a number Each document has an ID and other identifying values Examples: MongoDB and CouchDB Copyright © 2003-2016 Curt Hill
Graph A mathematical graph consists of nodes (the data) and links between these Used for highly interconnected data Processing rides the links NeoJ is an example Copyright © 2003-2016 Curt Hill