+---------------------+ +---------------------+ | Account A | | Account B | | Balance: $1000 | | Balance: $500 | |---------------------| |---------------------| | Debit: $100 (-) |----------> | Credit: $100 (+) | +---------------------+ +---------------------+ | | | | V V Atomicity: Atomicity: Both actions succeed Both actions succeed or none do. or none do.
Total balance remains the same: $1000 + $500 = $1500 Consistency: Total amount conserved.
[Transaction 1] [Transaction 2] +--------------------+ +---------------------+ | Transfer: A to B | | Transfer: C to D | |--------------------| |---------------------| | Isolated from | | Isolated from | | Transaction 2 | | Transaction 1 | +--------------------+ +---------------------+ Isolation: Transactions don't interfere with each other
CRASH ----- Durability: Balances are saved, even after failure After system restarts: +---------------------+ +---------------------+ | Account A | | Account B | | Balance: $900 | | Balance: $600 | +---------------------+ +---------------------+
SELECT Y.year, PG.name, DI.disc, count(*)
FROM year Y, month M, day D, session S,
line_item I, order O, product P, productgroup PG,
discount DI, order_status OS
WHERE M.year_id = Y.id and
D.month_id = M.id and
S.day_id = D.id and
O.session_id = S.id and
I.order_id = O.id and
I.product_id = P.id and
P.productgroup_id = PG.id and
DI.productgroup_id = PG.id and
O.id = OS.order_id and
D.day < 24 and
M.month = 12
and OS.status='FINISHED'
GROUP BY Y.year, PG.name, DI.discount
ORDER BY Y.year, DI.discount
"A subject-oriented, integrated, time-variant, and non-volatile collection of data in support of management's decision-making process."
"A copy of transaction data specifically structured for query and analysis."
Aspect | Data Warehouse | Operational Database |
---|---|---|
Purpose | Analytics | Transactions |
Data model | Dimensional | Normalized |
Data freshness | Periodic updates | Real-time |
Query complexity | Complex, unpredictable | Simple, predictable |
User base | Analysts, executives | Clerks, customers |
Aspect | OLTP | OLAP |
---|---|---|
Workload | Many short, atomic transactions | Few complex queries |
Data model | Highly normalized | Typically denormalized (star or snowflake schema) |
User types | Clerks, customers, automated processes | Knowledge workers, business analysts, executives |
Records accessed | Tens | Millions |
If you have any questions or comments, please do not hesitate to contact me:
pierre[dash]henri[dot]paris[at]universite[dash]paris[dash]saclay[dot]fr