A3.4 · Book pp. 195–203
Alternative databases and data warehouses
HL only This whole section is for Higher Level students.
Tables are not the answer to everything. Friends lists, live game scores and years of sales data each call for a different tool.
What you need to know
A3.4.1 Types of databases
NoSQL databases
NoSQL databases handle large volumes and many data types, and they store data differently from tables.
| Type | Stores | Used for | Strength | Weakness | Example |
|---|---|---|---|---|---|
| Document | JSON-like documents of fields and values | Content management, online shops | Flexible, and handles hierarchies well | Redundancy and inconsistency | MongoDB |
| Key-value | Key and value pairs | Caching, sessions, real-time data | Simple, with very fast reads and writes | Limited querying | Redis |
| Wide-column | Rows with dynamic columns | Big data, real-time analytics | Scales out, and suits sparse data | Complex to implement | Cassandra |
| Graph | Nodes and edges | Social media, recommendations | Great for complex relationships | Specialized query language | OrientDB |
Other database types
| Type | What it is | Strength | Weakness |
|---|---|---|---|
| Cloud | Runs on a cloud platform, either self-managed or as a managed service | Scalable and available, paying for what you use | Depends on the provider, and can cost more |
| Spatial | Stores points, lines, polygons and coordinates | Efficient for maps, GIS and location services | Complex types needing specialist knowledge |
| In-memory | Keeps data in RAM rather than on disk | Extremely fast, for caching, gaming and live analytics | RAM costs more, and needs a plan for power loss |
A self-managed cloud database gives you full control of the database, while the provider runs the infrastructure. A managed service has the vendor handle backups, scaling and patching.
✏️ Book correction
The book gives “low latency” as a drawback of in-memory databases. Low latency means little delay, which is a benefit. The real drawbacks are the cost of RAM and the risk of losing data in a power failure.
A3.4.2 Data warehouses
A data warehouse stores large amounts of historical data from many sources for analysis, not for day-to-day transactions.
| Append-only | New versions are added as rows, not overwritten, so change can be studied |
| Subject-oriented | Organized around themes such as sales or finance |
| Integrated | Combines many sources through ETL into a single source of truth |
| Time-variant | Keeps history, which allows trend analysis |
| Non-volatile | Data is rarely changed or deleted once loaded |
| Optimized for queries | Chooses efficient strategies for fast analysis |
Taking care with ETL
- Extraction must not disrupt the source system.
- Different formats must be converted into something readable.
- Extracted data must be relevant to what users need.
A3.4.3 OLAP and data mining
Business intelligence uses technology to collect, analyse and present information for better decisions.
Online analytical processing (OLAP)
OLAP lets users interactively explore data across dimensions such as time, product and region. Summaries are pre-aggregated, so they come back quickly and can feed charts and dashboards.
Data mining
Data mining finds hidden patterns in large data sets using statistics and machine learning, for forecasting, customer segmentation and fraud detection.
| Technique | What it does | Used for |
|---|---|---|
| Classification | Sorts data into known labels (supervised) | Spam detection, credit scoring |
| Clustering | Groups similar data with no labels (unsupervised) | Market segmentation |
| Regression | Predicts a continuous number | Sales forecasts, prices |
| Association rules | Finds items that occur together | Cross-selling recommendations |
| Sequential patterns | Finds events that occur in a certain order | Clickstream analysis |
| Anomaly detection | Finds rare, unusual data | Fraud, equipment failure |
A3.4.4 Distributed databases
A distributed database keeps its data on different sites, yet users see one unified database. Online shops and telecoms companies use them across regions.
ACID across nodes
| Atomicity | A transaction commits on all nodes or is rolled back on all |
| Consistency | All nodes see the same data afterwards |
| Isolation | Transactions on different nodes cannot interfere |
| Durability | Committed work is stored and replicated across nodes |
Features
| Concurrency control | Manages simultaneous changes with locks or timestamps |
| Data consistency | All copies reflect the latest correct state |
| Data partitioning | Splits data across nodes for speed and scale |
| Data security | Encryption, roles and multifactor authentication |
| Distribution transparency | Users work as if it were one database |
| Location transparency | Users need not know where data is stored |
| Fault tolerance | Keeps working through failures, using redundancy |
| Global query processing | Coordinates queries across several nodes |
| Replication | Keeps copies on several nodes for availability |
| Scalability | Spreads a growing load over more nodes |
Quick quiz
Exam-style questions
These are written for this site in the style of Paper 1. Answer on paper first, then open the mark points.
-
Define the term “data mining”. [1]
Mark points
- The process of sorting through large data sets to find patterns and relationships that help solve problems [1].
-
Explain the role of integrated data in a data warehouse. [2]
Mark points
- Data from many systems is combined using ETL [1].
- This gives one consistent source of truth for analysis [1].
-
Describe concurrency control in distributed databases and how it can be achieved. [4]
Mark points
- It manages simultaneous access to shared data on several nodes [1].
- It prevents conflicts such as lost updates [1].
- Locks stop other transactions using data until commit [1].
- Or timestamps set the order in which transactions run [1].
-
Compare a document database with a relational database. [4]
Mark points
- A relational database uses a fixed schema of tables, while documents are flexible [1].
- Documents suit unstructured or hierarchical data [1].
- Relational data has less redundancy, because of normalization [1].
- Relational databases give strong transactions and joins, while document stores scale out more easily [1].
-
Compare classification and sequential pattern discovery. [4]
Mark points
- Classification assigns data to known categories [1].
- It is used for spam detection, for example [1].
- Sequential pattern discovery finds events in a time order [1].
- It is used for clickstream analysis, for example [1].
-
Outline the role of OLAP in business intelligence. [3]
Mark points
- It lets users analyse data across dimensions interactively [1].
- Pre-aggregated views allow quick summaries [1].
- Ad hoc queries answer questions without predefined reports, which supports decisions [1].
-
Outline two differences between a database view and a data warehouse. [2]
Mark points
- A view is a virtual table from a query, while a warehouse physically stores data [1].
- A view presents existing data from one database, while a warehouse combines historical data from many sources [1].