Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Relational vs. Non-Relational

7,627 views

Published on

Published in: Technology
  • Be the first to comment

Relational vs. Non-Relational

  1. 1. Relational vs.Non-Relational Josh Berkus PostgreSQL Experts Inc. SCALE 2010
  2. 2. 2003: ● MySQL ● PostgreSQL ● FireBird ● BerkeleyDB ● Derby ● HSQLDB ● SQLite
  3. 3. 2003: ● MySQL ● PostgreSQL ● FireBird ● BerkeleyDB ● Derby ● HSQLDB ● SQLite
  4. 4. 2010● MySQL● PostgreSQL● FireBird● BerkeleyDB● Derby● HSQLDB● SQLite
  5. 5. “NoSQLmovement”
  6. 6. Allnon-relational databases
  7. 7. Are notthe same
  8. 8. G ra ph D o c um ent Neo4J C ouchD B HyperGraphDB B erkeleyD B -X M L Jena S olrK ey-va lue D is tributed M emcached C assandra Tokyo C abinet Hypertable db4o M yS Q L ND B R IAK H iera rc hic a l M ongoD B
  9. 9. Allrelationaldatabases
  10. 10. Are notthe same
  11. 11. E m bedded O LT P S QLite P ostgreS Q L Firebird M yS Q L HS Q L O racle S Q L S erverM PP S trea m ing TeraD ata Greenplum S treambase Aster Truviso C -S to re LucidD B M onetD B
  12. 12. NoFins
  13. 13. “NoSQLmovement”
  14. 14. Mythbust #2
  15. 15. “revolutionary”
  16. 16. There
  17. 17. are
  18. 18. no
  19. 19. new
  20. 20. database
  21. 21. designs
  22. 22. There are only new implementations and combinations
  23. 23. “A database storing application- friendly formatted objects, each containing collections ofattributes which can be searched through a document ID, or the creation of ad-hoc indexes as needed by the application.”
  24. 24. CouchDB, 2007 Pick, 1965
  25. 25. CouchDB, 2007embeddable Pick JSON storage REST API map/reduce
  26. 26. “revolutionary”
  27. 27. “revolutionary”
  28. 28. “renaissance ofnon-relational databases”
  29. 29. Mythbust #3
  30. 30. “non-relational databases are toys”
  31. 31. GoogleBigtable
  32. 32. AmazonDynamo
  33. 33. FaceBookMemcached
  34. 34. US VetransAdministration Pick, Caché
  35. 35. Mythbust #4
  36. 36. “Relational databaseswill become obsolete”
  37. 37. “Three decades past, the relational empire conquered the hierarchical hegemony. Today, an upstart challenges the relational empires dominance ...” XML Databases 2001 --Philip Wadler, Keynote VLDB, Rome, September 2001
  38. 38. Anyone remember XML databases?
  39. 39. No?
  40. 40. What happened?
  41. 41. established relational and non-relational databases hybridized XML
  42. 42. Oracle XMLPostgreSQL XML2 BerkeleyDB XML DB2
  43. 43. Mythbust #5
  44. 44. “Relational databasesare for when you need ACID transactions.”
  45. 45. Transactions ≠ Relational
  46. 46. Robust Transactions without Relationality: BerkeleyDB Amazon DynamoSQL Without Transactions: MySQL MyISAM MS Access
  47. 47. Mythbust #6
  48. 48. You
  49. 49. do
  50. 50. not
  51. 51. have
  52. 52. to choose
  53. 53. onedatabase.
  54. 54. Choosethe database system which f ts your i current application goals. or ...
  55. 55. Use more than one togetherMySQL + Memcached PostgreSQL + CouchDB or ...
  56. 56. Use a Hybrid MySQL NDBPostgreSQL Hstore HadoopDB
  57. 57. But what about relational vsnon-relational?
  58. 58. Relational OLTP Databases*● Transactions: more mature support – including multi-statement● Constraints: enforce data rules absolutely● Consistency: enforce structure 100%● Complex reporting: keep management happy!● Vertical scaling (but not horizontal) * mature ones, anyway
  59. 59. SQL vs. Not SQLSQL promotes:● portability● managed changes over time● multi-application access● many mature tools
  60. 60. SQL vs. Not SQLBut …SQL is a full programming language,and you have to learn it to use it.
  61. 61. SQL vs. Not SQLNo-SQL allows:● programmers as DBAs● no impedance● fast interfaces● fast development
  62. 62. The main reasonto use SQL-RDBMSs
  63. 63. “Immortal Data” your data has a life independent of this specif c iapplication implementation
  64. 64. How do Ichoose?
  65. 65. Def ne the problem i you are trying to solve
  66. 66. ● “I need a database for my blog”● “I need to add 1000s of objects per second on a low- end device.”● “I need my database to enforce business rules across several applications.”● “I want my application to be location-sensitive.”● “I need to cache data an access it 100K times per second.”● “I need to produce summary reports across 2TB of data.”● “I have a few hundred government documents I need to serve on the web and mine”● “I need to know who-knows-who-knows-who.”● “I need to data mine 1000s of 30K bug reports per minute.”
  67. 67. Def ne the features iyou actually need ● many connections ● multi-server scalability ● complex query logic ● APIs ● redundancy ● data integrity ● schema/schemaless ● data mining
  68. 68. if t the database to the task
  69. 69. “I need a database for my blog”
  70. 70. Use anything! ● MySQL ● PostgreSQL ● MongoDB ● SQLite ● CouchDB ● Flatf les i ● DBaseIII ● Something you wrote yourself
  71. 71. “I need my database to unify several applications andkeep them consistent.”
  72. 72. PostgreSQL “OLTP SQL-Relational Database”“Its not just a database: its a development platform”
  73. 73. Postgres 9alpha out now!
  74. 74. “I need my applicationto be location-aware.”
  75. 75. PostGIS“Geographic Relational Database”
  76. 76. PostGIS● Queries across “contains” “near” “closest”● Complex geometric map objects – polygons – lines (roads, etc)● Make your own Google Maps! – Sunday, 4:30pm, Concourse A
  77. 77. “I need to store1000s of event objects per second onembedded hardware.”
  78. 78. db4object“Embedded Key-Value Store”
  79. 79. db4object● German Train System● Insert 1000s of objects per second● Low-end embedded console computer● Simple access in native programming language (Java, .NET) ● compromise: embedded SQL database: SQLite
  80. 80. “I need to access 100K objects per second over 1000s of connections.”
  81. 81. memcached“Distributed In-Memory Key-Value Store”
  82. 82. memcached● Use: public website● Used for caching 1000s of serialized objects per second● Available for 100000s of requests per second across 1000s of connections● Cache each object only once per site● Supplements a relational database Alternatives: Redis, TokyoTyrant
  83. 83. “I need to producecomplex summary reportsover 2TB of data.”
  84. 84. LucidDB “RelationalColumn-Store”
  85. 85. LucidDB● For reporting and analysis● Large quantities of data (TB)● Complex OLAP & analytics queries● Business intelligence● compliments a transactional database
  86. 86. “I have 100s ofgovernment documents I need to serve on the web and mine for data.”
  87. 87. CouchDB“Document Store”
  88. 88. CouchDB1.CividDB Project2.Storing lots and lots of government documents3.Dont know whats in them4.Dont know how they are structured5.Store them, f gure out structure later by data i mining. Its also good for web sites!
  89. 89. “I have a social application and I need to know who-knows- who-knows- who-knows-who-knows-who.”
  90. 90. Neo4j“Graph Database”
  91. 91. Neo4j● Social Network Website● 6 degrees of separation● “you may also like”● type and degrees of relationship
  92. 92. “I get 1000s of30K bug reports per minute and I needto mine them for trends.”
  93. 93. Hadoop“Massively Parallel Data Mine”
  94. 94. Hadoop● Massive bug report data feed● 1000s of bug reports per minute● Each bug report 2-45K of data● Need to extract trends and correlate inexact data● Summarize in daily & weekly reports
  95. 95. Conclusion● Different database systems do better at different tasks. – every database feature is a tradeoff – no database can do all things well● Relational vs. non-relational doesnt matter – pick the database(s) for the project or the task
  96. 96. Questions?● PostgreSQL Project ● PostgreSQL Booth – www.postgresql.org trade show f oor l – josh@postgresql.org ● PostgreSQL 9.0● PostgreSQL Experts BOF, Tonight 7pm – www.pgexperts.com ● www.pgexperts.com/documents.html● Open Source Database Survey – Selena Deckleman – Open Source Database Survey: www.ossdbsurvey.orgCopyright 2010 Josh Berkus, distributable under the creative commons attribution license,except for 3rd-party images which are property of their respective owners.Special thanks to Selena Deckelman for the bunnies image and forthe Open Source Database survey.

×