* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Database Management
Commitment ordering wikipedia , lookup
Serializability wikipedia , lookup
Relational algebra wikipedia , lookup
Microsoft Access wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Global serializability wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Oracle Database wikipedia , lookup
Navitaire Inc v Easyjet Airline Co. and BulletProof Technologies, Inc. wikipedia , lookup
Encyclopedia of World Problems and Human Potential wikipedia , lookup
Functional Database Model wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Microsoft SQL Server wikipedia , lookup
Concurrency control wikipedia , lookup
Ingres (database) wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Clusterpoint wikipedia , lookup
Healthcare Cost and Utilization Project wikipedia , lookup
Relational Database Features Database Management Peter Wood Non-Relational Databases Why has the relational model been so successful? I Data independence I High level query language - SQL I Query optimisation I Support for integrity constraints I Well-understood database design I Transaction management and concurrency Object-oriented and object-relational databases No SQL databases Relational Database Limitations Database Management Peter Wood Non-Relational Databases 1. all data is value-based - all relationships are expressed through common values Object-oriented and object-relational databases 2. data must always be represented in ’flat’ (first normal form) relations No SQL databases 3. for some applications, performance is not fast enough Relational Database Limitations Database Management Peter Wood Non-Relational Databases 1. all data is value-based - all relationships are expressed through common values Object-oriented and object-relational databases 2. data must always be represented in ’flat’ (first normal form) relations No SQL databases 3. for some applications, performance is not fast enough I Limitations 1 and 2 led to the development of object-oriented and object-relational databases I Limitations 2 and 3 led to the development of NoSQL databases Why might we need Object-Oriented Databases? Database Management Peter Wood Non-Relational Databases Object-oriented and object-relational databases I For some applications 1NF is too strict. I I I I I Document management and web site management Geographic and statistical data Biological data ... All these use complex (nested) objects of some form, where object identity and references help No SQL databases Object-Oriented Databases Database Management Peter Wood Non-Relational Databases Support I object identity I complex object structures I classes and inheritance I object encapsulation (methods for object manipulation) I high-level query language (OQL) I ... Object-oriented and object-relational databases No SQL databases Object-Relational Databases Database Management Peter Wood Object-relational systems (and SQL:1999) add a number of object-oriented features to relational systems, including: I user-defined types I type inheritance I table inheritance I array and multiset types I object identity I reference types I methods We will consider the first four of these briefly below. Non-Relational Databases Object-oriented and object-relational databases No SQL databases Creating User-Defined Types Database Management Peter Wood Non-Relational Databases CREATE TYPE NameType AS ( firstname varchar(20), lastname varchar(20)) FINAL; CREATE TYPE AddressType AS ( street varchar(20), city varchar(20) postcode varchar(8)) NOT FINAL; FINAL and NOT FINAL relate to subtyping (see later) Object-oriented and object-relational databases No SQL databases Using User-Defined Types Database Management Peter Wood Non-Relational Databases CREATE TABLE person ( name NameType, address AddressType, dateOfBirth date); Note that the above table definition uses the user-defined types NameType and AddressType, along with the built-in type date Object-oriented and object-relational databases No SQL databases Using User-Defined Types Database Management Peter Wood Non-Relational Databases CREATE TABLE person ( name NameType, address AddressType, dateOfBirth date); Note that the above table definition uses the user-defined types NameType and AddressType, along with the built-in type date An SQL example using the above definition is: SELECT name.firstname, name.lastname FROM person; Object-oriented and object-relational databases No SQL databases Type Inheritance Database Management Peter Wood CREATE TYPE PersonType ( name NameType, address AddressType) NOT FINAL; Non-Relational Databases Object-oriented and object-relational databases No SQL databases CREATE TYPE StudentType UNDER PersonType ( degree varchar(20), department varchar(20)) FINAL; StudentType is a subtype of PersonType. NOT FINAL means the type can have subtypes. FINAL means the type cannot have subtypes. StudentType inherits the attributes of PersonType. Table Inheritance Database Management Peter Wood Non-Relational Databases CREATE TABLE person OF PersonType; CREATE TABLE student OF StudentType UNDER person; Table student will have all attributes of StudentType (which includes those of PersonType). Object-oriented and object-relational databases No SQL databases Table Inheritance Database Management Peter Wood Non-Relational Databases CREATE TABLE person OF PersonType; CREATE TABLE student OF StudentType UNDER person; Table student will have all attributes of StudentType (which includes those of PersonType). Every tuple in student is implicitly also in person, so SELECT * FROM person retrieves all person tuples, including student tuples. Object-oriented and object-relational databases No SQL databases Array and Multiset Types Multiset (a set with possibly duplicate elements) types were added in SQL:2003. CREATE TYPE Book AS ( title varchar(20), authors varchar(20) array [10], keywords varchar(20) multiset) NOT FINAL; CREATE TABLE books OF Book; Database Management Peter Wood Non-Relational Databases Object-oriented and object-relational databases No SQL databases Array and Multiset Types Multiset (a set with possibly duplicate elements) types were added in SQL:2003. CREATE TYPE Book AS ( title varchar(20), authors varchar(20) array [10], keywords varchar(20) multiset) NOT FINAL; CREATE TABLE books OF Book; INSERT INTO books VALUES (’Database System Concepts’, array[’Silberschatz’, ’Korth’, ’Sudarshan’], multiset[’computer’, ’database’, ’SQL’]); Database Management Peter Wood Non-Relational Databases Object-oriented and object-relational databases No SQL databases Array and Multiset Types Multiset (a set with possibly duplicate elements) types were added in SQL:2003. CREATE TYPE Book AS ( title varchar(20), authors varchar(20) array [10], keywords varchar(20) multiset) NOT FINAL; CREATE TABLE books OF Book; INSERT INTO books VALUES (’Database System Concepts’, array[’Silberschatz’, ’Korth’, ’Sudarshan’], multiset[’computer’, ’database’, ’SQL’]); SELECT authors[1] FROM books WHERE ’database’ IN (UNNEST(keywords)); Database Management Peter Wood Non-Relational Databases Object-oriented and object-relational databases No SQL databases Database Management NoSQL Peter Wood Non-Relational Databases I NoSQL stands for “Not only SQL” I Used to refer to various approaches which are non-relational These include I I I I I Key-value stores XML databases Document stores Graph databases Object-oriented and object-relational databases No SQL databases NoSQL Systems Database Management Peter Wood Non-Relational Databases Object-oriented and object-relational databases I Offer scalability and extensibility over loosely-coupled clusters of commodity hardware. I As a result, they are often used in large-scale web-based applications. I They typically do not offer the extensive transaction management (ACID) capabilities of RDBMSs. No SQL databases Key-value Stores Database Management Peter Wood Non-Relational Databases I Used by Amazon, e.g., for high availability I see the paper “Dynamo: Amazon’s Highly Available Key-Value Store” (2007), published in ACM Symposium on Operating System Principles I A key-value store enables the storage and retrieval of values by key. I It is essentially a big hash table. I The values are simply sequences of bytes. I It is up to an application to interpret any logical structure within the values. I An example system is Redis (www.redis.io) Object-oriented and object-relational databases No SQL databases XML Databases Database Management Peter Wood I Data model is that of XML (elements and attributes). I XML allows for flexible, nested structures (no schema is necessary). Non-Relational Databases Object-oriented and object-relational databases <friends> No SQL databases <person> <name>Alice</name><email>alice@...</email> </person> <person> <name>Bob</name><phone>012...</phone> </person> </friends> I The query language is usually XQuery (www.w3.org/TR/xquery-30). I An example system is eXist (www.exist-db.org). Document Stores I I I I Database Management Peter Wood Like a key-value store, a document store enables the Non-Relational storage and retrieval of values by key. Databases In this case, the values do have structure (each is a Object-oriented and “document”). object-relational databases The syntax used for documents is usually JSON No SQL databases (JavaScript Object Notation). { "friends": [ { "person": { "name": "Alice", "email": "alice@..." } }, { "person": { "name": "Bob", "phone": "012..." } } ] } An example system is MongoDB (www.mongodb.org). Database Management Graph Example Peter Wood A graph of airports and flight durations: Non-Relational Databases LHR 7 1 2 JFK Object-oriented and object-relational databases No SQL databases MAD CDG 14 12 8 14 LIM 4 SCL Nodes represent airports Edges represent flight connections e.g., it takes 7 hours to fly between London Heathrow and JFK (New York) Graph Databases Database Management Peter Wood Non-Relational Databases I A graph store represents information in a graph consisting of nodes and edges. I Nodes and edges both typically have properties associated with them. I Common queries in graphs involve finding connections (paths) between nodes. I An example system is Neo4J (www.neo4j.com). I Neo4J uses its own query language called Cypher. Object-oriented and object-relational databases No SQL databases Summary Database Management Peter Wood Non-Relational Databases I Performance requirements may force you to adopt a simpler data model and/or do without ACID guarantees, e.g., I I a key-value store a document store Object-oriented and object-relational databases No SQL databases Summary Database Management Peter Wood Non-Relational Databases I Performance requirements may force you to adopt a simpler data model and/or do without ACID guarantees, e.g., I I I a key-value store a document store Complex and/or uncertain data requirements may suggest a more complex and/or flexible data model is needed, e.g., I I I object(-relational) database XML database graph database Object-oriented and object-relational databases No SQL databases