Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Heroku Postgres Webinar

Heroku Postgres Webinar

Craig Kerstiens

August 23, 2012
Tweet

More Decks by Craig Kerstiens

Other Decks in Programming

Transcript

  1. Heroku  Postgres  Webinar
    Craig  Kerstiens
    Matt  Soldo

    View Slide

  2. Architecture
    Heroku Runtime
    Database.com Heroku Postgres
    Force.com
    Other
    Platforms

    View Slide

  3. Heroku  Postgres
    Social  Enterprise  DBaaS
    SQL  Database-­‐as-­‐a-­‐Service
    Database.com

    View Slide

  4. Let’s  Provision  a  Database

    View Slide

  5. Heroku
    Postgres
    Management Services
    Postgres
    Value-Added Features

    View Slide

  6. Heroku
    Postgres
    Management Services
    Postgres
    Value-Added Features

    View Slide

  7. Management  Services

    View Slide

  8. Setup
    Manage
    Security
    Backup
    Scale
    Query
    DBA  Tasks

    View Slide

  9. Setup
    Manage
    Security
    Backup
    Scale
    Query
    DBA  Tasks

    View Slide

  10. We  hold  the  pager
    Health  Checks
    Continuous  Protection

    View Slide

  11. Heroku
    Postgres
    Management Services
    Postgres
    Value-Added Features

    View Slide

  12. Heroku
    Postgres
    Management Services
    Postgres
    Value-Added Features

    View Slide

  13. 100%  Compatible

    View Slide

  14. Why  Postgres?

    View Slide

  15. Users Purchases
    Products

    View Slide

  16. CREATE  TABLE  products  (
           id  integer  NOT  NULL,
           title  character  varying(255),
           description  text,
           price  numeric(10,2)
    );

    View Slide

  17. CREATE  TABLE  users  (
           id  integer  NOT  NULL,
           first_name  character  varying(50),
           last_name  character  varying(50),
           email  character  varying(255),
           data  hstore,
           created_at  timestamp  without  time  zone,
           updated_at  timestamp  without  time  zone,
           last_login  timestamp  with  time  zone
    );

    View Slide

  18. CREATE  TABLE  purchases  (
           id  integer  NOT  NULL,
           user_id  integer,
           items  decimal(10,2)  [][],
           occurred_at  timestamp
    );

    View Slide

  19. CREATE  TABLE  purchases  (
           id  integer  NOT  NULL,
           user_id  integer,
           items  decimal(10,2)  [][],
           occurred_at  timestamp
    );

    View Slide

  20. CREATE  TABLE  purchases  (
           id  integer  NOT  NULL,
           user_id  integer,
           items  decimal(10,2)  [][],
           occurred_at  timestamp
    );
    items[x][0] = item_id
    items [x][1] = qty
    items [x][2] = price

    View Slide

  21. Data  Types
    INSERT  INTO  purchases  VALUES  (
       2,  2,  '{{11.0,  1.0,  4.99}}',  now()
    );

    View Slide

  22. Data  Types
    smallint
    bigint
    integer
    numeric
    float
    serial
    money
    char
    varchar
    text
    bytea
    timestamp
    timestamptz date
    time
    timetz
    interval
    boolean
    enum
    point
    line
    polygon
    box
    circle
    path
    inet cidr
    macaddr
    tsvector
    tsquery
    array
    XML
    UUID

    View Slide

  23. Other  Languages
    CREATE  OR  REPLACE  FUNCTION  total(decimal(10,2)[][])  
    RETURNS  decimal(10,2)  AS  $$
    DECLARE
       s  decimal(10,2)  :=  0;
       x  decimal[];
    BEGIN
       FOREACH  x  SLICE  1  IN  ARRAY  $1
       LOOP
           s  :=  s  +  (x[2]  *  x[3]);
       END  LOOP;
       RETURN  s;
    END;
    $$  LANGUAGE  plpgsql;

    View Slide

  24. Other  Languages
    FOREACH  x  SLICE  1  IN  ARRAY  $1
       LOOP
           s  :=  s  +  (x[2]  *  x[3]);
       END  LOOP;
       RETURN  s;

    View Slide

  25. Other  Languages
    python
    ruby
    pgsql
    SQL
    tcl
    sh
    R
    V8
    Java
    javascript
    lolcode
    scheme
    php
    j
    lua
    psm

    View Slide

  26. Extensions
    CREATE  EXTENSION  hstore;
    CREATE  TABLE  users  (
           id  integer  NOT  NULL,
           first_name  character  varying(50),
           last_name  character  varying(50),
           email  character  varying(255),
           data  hstore,
           created_at  timestamp  without  time  zone,
           last_login  timestamp  without  time  zone
    );

    View Slide

  27. Extensions
    INSERT  INTO  users  
    VALUES  (
    1,  
    'Craig',  
    'Kerstiens',  
    '[email protected]',  
    'sex  =>  "M",  state  =>  "CA"',  
    now(),  
    now()
    );

    View Slide

  28. Extensions
    dblink hstore
    citext
    ltree
    isn
    cube
    pgcrypto
    tablefunc
    uuid-ossp
    earthdistance
    trigram
    fuzzystrmatch
    pgrowlocks
    pgstattuple
    btree_gist
    dict_int
    dict_xsyn
    unaccent

    View Slide

  29. Heroku
    Postgres
    Management Services
    Postgres
    Value-Added Features

    View Slide

  30. Heroku
    Postgres
    Management Services
    Postgres
    Value-Added Features

    View Slide

  31. Data  Clips
    The  easiest  way  to  share  your  data

    View Slide

  32. SELECT *
    FROM sales
    WHERE amount > 1
    +
    Your Live
    Production Data

    View Slide

  33. https://postgres.heroku.com/dataclips/{unique  &  secure  hash}

    View Slide

  34. Followers
    Master
    Database
    Follower  1
    Follower  2
    Write  Transactions
    Read  Transactions

    View Slide

  35. Followers
    Master
    Database
    Follower  1
    Follower  2
    Write  Transactions
    Read  Transactions

    View Slide

  36. Followers
    Master
    Database
    New  Master
    Follower  2
    Write  Transactions
    Read  Transactions

    View Slide

  37. Pricing  and  Availability

    View Slide

  38. Learn  More
    Try  It  free:      https://postgres.heroku.com
    Code:                        https://github.com/craigkerstiens/postgres-­‐demo
    Survey:                http://bit.ly/herokupostgressurvey
    [email protected]    |    [email protected]

    View Slide