Graph Databases, Column Stores, Key Value Stores and Document Databases Flashcards
Relational Database
Primary keys prevent duplication, foreign keys enforce referential integrity and normal form rules prevent anomalies.
Data is always consistent. However performance issues may occur if it is too big and there may be wasted space.
Graph Databases
Viewing data as a mathematical graph; relationships between data are key but they do not always need to have the same values. Often used in social networking
Advantages of Graph Databases
- Flexible structure
- Clear representation of relationships
- Speed depends on relationships rather than amount of data
Disadvantages of Graph Databases
- Difficult to scale as it is a one-tier architecture
- No uniform query language
Column Stores
Column stores have tables like relational databases however the data is stored in column rather than rows e.g.
Column 1: (‘Jason’, ‘Steve’)
Column 2: (‘Steggles’, ‘Riddle’)
Advantages/Disadvantages of Column Stores
Performance of searching for a specific column is much faster BUT for a specific row is much slower
Hashing
Key-Value stores are based on hashing. Applying a hash function to a key to determine where each piece of data is stored in memory
Keys
Keys are the raw data which has a hashing function applied to
Values
Values can be anything - different databases permit different data types. stored in the key
Advantages of Key-Value stores
- Querying is very simple
- Can have a large number of records
- Consistency does not need to be ensured
- Data variation
Disadvantages of Key-Value stores
- Lack of referential integrity: can have data in different types
- Basic querying only, can’t do many complex queries
Document Databases
Self contained - each document might have different numbers of fields and different fields to other documents.
Similar to key-value stores where there are keys, usually a text string. Document can be queried to return certain parts of it.
Representation of Document Databases
Documents might be in a variety of formats, e.g JSON, XML, PDF
Documents are similar to objects in object oriented programming
Basic operations are permitted (CRUD)
Advantages of document databases
- Can be good with a variety of data as documents can contain different fields
- Key valued storage approaches offers quick performance
Disadvantages of document databases
- Basic operations only
- No normalisation at all; same information can be duplicated in different documents
- Inconsistencies can arise between different documents if the data is entered in incorrectly or updated but not changed in all documents