Relational or Not Full

Embed Size (px)

Citation preview

  • 8/14/2019 Relational or Not Full

    1/98

    Relational

    vs.Non-RelationalJosh BerkusPostgreSQL Experts Inc.

    SCALE 2010

  • 8/14/2019 Relational or Not Full

    2/98

    2003:

    MySQL

    PostgreSQL

    FireBird BerkeleyDB

    Derby

    HSQLDB SQLite

  • 8/14/2019 Relational or Not Full

    3/98

    2003:

    MySQL

    PostgreSQL

    FireBird BerkeleyDB

    Derby

    HSQLDB SQLite

  • 8/14/2019 Relational or Not Full

    4/98

    2010

    MySQL

    PostgreSQL

    FireBird BerkeleyDB

    Derby

    HSQLDB SQLite

  • 8/14/2019 Relational or Not Full

    5/98

    NoSQLmovement

  • 8/14/2019 Relational or Not Full

    6/98

    All

    non-relational

    databases

  • 8/14/2019 Relational or Not Full

    7/98

    Are notthe same

  • 8/14/2019 Relational or Not Full

    8/98

    Graph

    Key-value

    Document

    Hierarchical

    Distributed

    Neo4JHyperGraphDBJena

    CouchDBBerkeleyDB-XMLS olr

    MemcachedTokyo Cabinet

    db4oRIAK

    CassandraHypertableMyS QL NDB

    MongoDB

  • 8/14/2019 Relational or Not Full

    9/98

    All

    relationaldatabases

  • 8/14/2019 Relational or Not Full

    10/98

    Are notthe same

  • 8/14/2019 Relational or Not Full

    11/98

    Embedded

    M PP

    OLTP

    Streaming

    C -S tore

    S QLiteFirebirdHSQL

    PostgreS QLMySQLOracleS QL S erver

    TeraDataGreenplum

    Aster

    LucidDBMonetDB

    S treambase

    Truviso

  • 8/14/2019 Relational or Not Full

    12/98

    NoFinsNoFins

  • 8/14/2019 Relational or Not Full

    13/98

  • 8/14/2019 Relational or Not Full

    14/98

    NoSQLmovement

  • 8/14/2019 Relational or Not Full

    15/98

    Mythbust #2

  • 8/14/2019 Relational or Not Full

    16/98

    revolutionary

  • 8/14/2019 Relational or Not Full

    17/98

    There

  • 8/14/2019 Relational or Not Full

    18/98

    are

  • 8/14/2019 Relational or Not Full

    19/98

    no

  • 8/14/2019 Relational or Not Full

    20/98

    new

  • 8/14/2019 Relational or Not Full

    21/98

    database

  • 8/14/2019 Relational or Not Full

    22/98

    designs

  • 8/14/2019 Relational or Not Full

    23/98

    There are only newimplementations

    andcombinations

  • 8/14/2019 Relational or Not Full

    24/98

    A database storing application-friendly formatted objects, each

    containing collections ofattributes which can be searched

    through a document ID, or thecreation of ad-hoc indexes asneeded by the application.

  • 8/14/2019 Relational or Not Full

    25/98

    CouchDB, 2007

    Pick, 1965

  • 8/14/2019 Relational or Not Full

    26/98

    CouchDB, 2007

    embeddable PickJSON storage

    REST APImap/reduce

  • 8/14/2019 Relational or Not Full

    27/98

    revolutionary

  • 8/14/2019 Relational or Not Full

    28/98

    revolutionary

  • 8/14/2019 Relational or Not Full

    29/98

    renaissanceof

    non-relationaldatabases

  • 8/14/2019 Relational or Not Full

    30/98

    Mythbust #3

  • 8/14/2019 Relational or Not Full

    31/98

    non-relational

    databasesare toys

  • 8/14/2019 Relational or Not Full

    32/98

    Bigtable

    Google

  • 8/14/2019 Relational or Not Full

    33/98

    Dynamo

    Amazon

  • 8/14/2019 Relational or Not Full

    34/98

    Memcached

    FaceBook

  • 8/14/2019 Relational or Not Full

    35/98

    Pick, Cach

    US Vetrans'

    Administration

  • 8/14/2019 Relational or Not Full

    36/98

    Mythbust #4

  • 8/14/2019 Relational or Not Full

    37/98

    Relational

    databaseswill become

    obsolete

  • 8/14/2019 Relational or Not Full

    38/98

    Three decades past, the relational

    empire conquered the hierarchicalhegemony. Today, an upstartchallenges the relational empire's

    dominance ...

    --Philip Wadler, KeynoteVLDB, Rome, September 2001

    XML Databases

    2001

  • 8/14/2019 Relational or Not Full

    39/98

    Anyone remember

    XML databases?

  • 8/14/2019 Relational or Not Full

    40/98

    No?

  • 8/14/2019 Relational or Not Full

    41/98

    What happened?

  • 8/14/2019 Relational or Not Full

    42/98

    established relationaland non-relational

    databaseshybridized XML

  • 8/14/2019 Relational or Not Full

    43/98

  • 8/14/2019 Relational or Not Full

    44/98

    Mythbust #5

  • 8/14/2019 Relational or Not Full

    45/98

    Relational databases

    are for when you needACID transactions.

  • 8/14/2019 Relational or Not Full

    46/98

    Transactions

    Relational

  • 8/14/2019 Relational or Not Full

    47/98

    Robust Transactions without

    Relationality:

    SQL Without Transactions:

    BerkeleyDB

    Amazon Dynamo

    MySQLMyISAMMS Access

  • 8/14/2019 Relational or Not Full

    48/98

    Mythbust #6

  • 8/14/2019 Relational or Not Full

    49/98

  • 8/14/2019 Relational or Not Full

    50/98

    You

  • 8/14/2019 Relational or Not Full

    51/98

    do

  • 8/14/2019 Relational or Not Full

    52/98

    not

  • 8/14/2019 Relational or Not Full

    53/98

    have

  • 8/14/2019 Relational or Not Full

    54/98

    to choose

  • 8/14/2019 Relational or Not Full

    55/98

    onedatabase.

  • 8/14/2019 Relational or Not Full

    56/98

    Choosethe database systemwhich fi ts your

    currentapplication goals.

    or ...

    Use more than one

  • 8/14/2019 Relational or Not Full

    57/98

    together

    MySQL + Memcached

    PostgreSQL +CouchDB

    or ...

    Use a Hybrid

  • 8/14/2019 Relational or Not Full

    58/98

    Use a Hybrid

    MySQL NDB

    PostgreSQL Hstore

    HadoopDB

  • 8/14/2019 Relational or Not Full

    59/98

    But what aboutrelational

    vsnon-relational?

    Relational OLTP

  • 8/14/2019 Relational or Not Full

    60/98

    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

    SQL vs. Not SQL

  • 8/14/2019 Relational or Not Full

    61/98

    SQL vs. Not SQL

    SQL promotes: portability

    managed changes over time multi-application access many mature tools

    SQL vs. Not SQL

  • 8/14/2019 Relational or Not Full

    62/98

    SQL vs. Not SQL

    But SQL is a full programming language,and you have to learn it to use it.

    SQL vs. Not SQL

  • 8/14/2019 Relational or Not Full

    63/98

    SQ s ot SQ

    No-SQL allows: programmers as DBAs

    no impedance fast interfaces fast development

  • 8/14/2019 Relational or Not Full

    64/98

  • 8/14/2019 Relational or Not Full

    65/98

    Immortal Data

    your data hasa lifeindependent

    of this specifi c

    application implementation

  • 8/14/2019 Relational or Not Full

    66/98

    How do I

    choose?

  • 8/14/2019 Relational or Not Full

    67/98

    Defi ne the problem

    you are tryingto solve

    I need a database for my blog

    I need to add 1000's of objects per second on a low-d d i

  • 8/14/2019 Relational or Not Full

    68/98

    end device.

    I need my database to enforce business rules acrossseveral 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 1000's of 30K bug reports perminute.

    Defi ne the featurest ll d

  • 8/14/2019 Relational or Not Full

    69/98

    you actuallyneed many connections

    multi-server scalability

    complex query logic APIs

    redundancy

    data integrity schema/schemaless

    data mining

  • 8/14/2019 Relational or Not Full

    70/98

    fi t the database

    to the task

  • 8/14/2019 Relational or Not Full

    71/98

    I need a database

    for my blog

    Use anything!

  • 8/14/2019 Relational or Not Full

    72/98

    y g

    MySQL PostgreSQL

    MongoDB

    SQLite CouchDB

    Flatfi les

    DBaseIII Something you wrote yourself

  • 8/14/2019 Relational or Not Full

    73/98

    I need my databaseto unify several

    applications andkeep them consistent.

    PostgreSQL

  • 8/14/2019 Relational or Not Full

    74/98

    OLTPSQL-Relational Database

    It's not just a database: it's a developmentplatform

  • 8/14/2019 Relational or Not Full

    75/98

    Postgres 9Postgres 9

    alpha out now!alpha out now!

  • 8/14/2019 Relational or Not Full

    76/98

    I need my application

    to be location-aware.

    PostGIS

  • 8/14/2019 Relational or Not Full

    77/98

    Geographic RelationalDatabase

  • 8/14/2019 Relational or Not Full

    78/98

  • 8/14/2019 Relational or Not Full

    79/98

    I need to store1000's of event objects

    per second onembedded hardware.

    db4object

  • 8/14/2019 Relational or Not Full

    80/98

    Embedded Key-ValueStore

    db4object

  • 8/14/2019 Relational or Not Full

    81/98

    German Train System Insert 1000's of objects per second

    Low-end embedded console computer

    Simple access in native programming language(Java, .NET)

    compromise: embedded SQL database:SQLite

  • 8/14/2019 Relational or Not Full

    82/98

    I need to access100K objects per

    secondover 1000's of

    connections.

    memcached

  • 8/14/2019 Relational or Not Full

    83/98

    Distributed In-MemoryKey-Value Store

    memcached

  • 8/14/2019 Relational or Not Full

    84/98

    Use: public website Used for caching 1000's of serialized objects

    per second

    Available for 100000's of requests per second

    across 1000's of connections Cache each object only once per site

    Supplementsa relational database

    Alternatives: Redis, TokyoTyrant

  • 8/14/2019 Relational or Not Full

    85/98

    I need to producecomplex summary

    reportsover 2TB of data.

    LucidDB

  • 8/14/2019 Relational or Not Full

    86/98

    RelationalColumn-Store

    LucidDB

  • 8/14/2019 Relational or Not Full

    87/98

    For reporting and analysis Large quantities of data (TB)

    Complex OLAP & analytics queries

    Business intelligence complimentsa transactional database

  • 8/14/2019 Relational or Not Full

    88/98

    I have 100's ofgovernment documentsI need to

    serve on the weband mine for data.

    CouchDB

  • 8/14/2019 Relational or Not Full

    89/98

    Document Store

    CouchDB

  • 8/14/2019 Relational or Not Full

    90/98

    1.CividDB Project2.Storing lots and lots of government documents

    3.Don't know what's in them

    4.Don't know how they are structured

    5.Store them, fi gure out structure later by datamining.

    It's also good for web sites!

    I have a social

  • 8/14/2019 Relational or Not Full

    91/98

    application andI need to know

    who-knows-who-knows-

    who-knows-who-knows-who.

    Neo4j

  • 8/14/2019 Relational or Not Full

    92/98

    Graph Database

    Neo4j

  • 8/14/2019 Relational or Not Full

    93/98

    Social Network Website

    6 degrees of separation

    you may also like

    type and degrees of relationship

    I get 1000's of

  • 8/14/2019 Relational or Not Full

    94/98

    I get 1000 s of30K bug reports

    per minute

    and I needto mine them for

    trends.

    Hadoop

  • 8/14/2019 Relational or Not Full

    95/98

    Massively Parallel Data Mine

    HadoopM i b d f d

  • 8/14/2019 Relational or Not Full

    96/98

    Massive bug report data feed

    1000's of bug reports per minute

    Each bug report 2-45K of data

    Need to extract trends and correlate inexactdata

    Summarize in daily & weekly reports

    ConclusionDiff t d t b t d b tt t

  • 8/14/2019 Relational or Not Full

    97/98

    Different database systems do better atdifferent tasks.

    every database feature is a tradeoff

    no database can do all things well

    Relational vs. non-relational doesn't matter pick the database(s) for the project or the task

    Questions?P t SQL P j t P t SQL B th

  • 8/14/2019 Relational or Not Full

    98/98

    PostgreSQL Project

    www.postgresql.org

    [email protected]

    PostgreSQL Experts

    www.pgexperts.com

    www.pgexperts.com/documents.html

    Open Source Database Survey

    Selena Deckleman

    Open Source Database Survey:www.ossdbsurvey.org

    PostgreSQL Boothtrade show fl oor

    PostgreSQL 9.0BOF, Tonight 7pm

    Copyright 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.