Application development wit ith relational and non-relational databases
Mario Lassnig European Organization for Nuclear Research (CERN) mario.lassnig@cern.ch
Application development wit ith relational and non-relational - - PowerPoint PPT Presentation
Application development wit ith relational and non-relational databases Mario Lassnig European Organization for Nuclear Research (CERN) mario.lassnig@cern.ch About me Software Engineer Data Management for the ATLAS Experiment, CERN,
Mario Lassnig European Organization for Nuclear Research (CERN) mario.lassnig@cern.ch
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 2
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 3
during the hands-on sessions; there’ll be exercises later where you’ll have to use what you’ve learned! Please interrupt me whenever necessary!
It is impossible for a distributed computer system to simultaneously provide all three of the following guarantees [Brewer, 2000]
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 5
Consistency Availability Partition tolerance
All clients always see the same data All clients can always read and write The data can be split across the system
Choose two. Web caching, DNS, … Distributed databases File systems, single-instance databases, …
ACID
all or nothing operations
always valid state
data is never lost BASE
more often than not
data might be lost
might return old data
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 6
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 7
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 8
Relational Non-relational
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 9
Relations Tuples Attributes
Table Row Column
Relation Attribute Tuple
http://www.ibm.com/developerworks/library/x-matters8/relat.gif
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 10
CREATE TABLE table_name; SELECT column_name FROM table_name; INSERT INTO table_name(column_name) VALUES (value); UPDATE table_name SET column_name = value; DELETE FROM table_name; DROP TABLE table_name;
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 11
http://www.tomjewett.com/dbdesign/dbdesign.php?page=manymany.php
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 12
for aggregation queries
native support for column-families
http://www.tutorialspoint.com/hbase/images/table.jpg
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 13
native protocols, or via REST
Key 1 Key 2 Key 3 Key 4 Value 1 Value 2 Value 3 Value 4
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 14
something about the internal structure of the value
http://docs.mongodb.org/v3.0/_images/data-model-denormalized.png
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 15
(that name though!)
http://blog.octo.com/wp-content/uploads/2012/07/RequestInSQL.png
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 16
http://blog.octo.com/wp-content/uploads/2012/07/RequestInGraph.png
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 17
(relational – row-based)
(relational – column-based)
(nonrelational – key/value)
(nonrelational – data structure)
(nonrelational – document)
(nonrelational – graph)
https://wiki.scc.kit.edu/gridkaschool/index.php/Relational_and_Non-relational_Databases
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 19
not help
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 20
https://docs.oracle.com/cd/B19306_01/server.102/b14220/img/cncpt158.gif http://www.mattfleming.com/files/images/example.gif
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 21
is likely – this can cause serious problems
another transaction
intermediate other transaction
PostgreSQL prohibits this by design
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 22
“generic” approach to metadata – please don’t do this
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 23
BEGIN; SELECT row FOR UPDATE ; COMMIT/ROLLBACK
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 25
http://gemsres.com/photos/story/res/43755/fig1.jpg
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 26
https://xkcd.com/327/
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 27
https://hackadaycom.files.wordpress.com/2014/04/18mpenleoksq8jpg.jpg?w=636
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 28
2015-09-08 GridKa School 2015 – Relational and Non-relational databases 30
import loremipsum loremipsum.generate_sentence()
Mario Lassnig European Organization for Nuclear Research (CERN) mario.lassnig@cern.ch