Heroku Postgres

Post on 10-May-2015

2091 Views

Category:

Technology

7 Downloads

Preview:

Click to see full reader

DESCRIPTION

2012年12月6日 Cloudforce Japan Developer Zone内のシアターで講演された資料です。

Transcript

http://postgres.heroku.com

ウィル・ラインウェバー@leinweber

Heroku,Inc.

アーキテクチャArchitecture

Heroku 実行環境Heroku Runtime

Database.com Heroku Postgres

Force.com その他Others

Heroku Postgres

Social Enterprise DBaaS

SQL Database-as-a-Service

Database.com

データベースをつくってみようLet’s Provision a Database

heroku addons:add heroku-postgres:dev -a will

Heroku Postgres

マネージドサービスManagement Services

Postgres

拡張機能Value-Added Features

Heroku Postgres

マネージドサービスManagement Services

Postgres

拡張機能Value-Added Features

マネージドサービスManaged Services

セットアップSetup

管理・監視Manage

セキュリティSecurity

バックアップBackup

拡張Scale

データ定義/抽出Query

DB管理者の仕事DBA Tasks

セットアップSetup

管理・監視Manage

セキュリティSecurity

バックアップBackup

拡張Scale

データ定義/抽出Query

DB管理者の仕事DBA Tasks

24x365 監視体制24x365 Monitoring

ヘルスチェックHealth Checks

継続的なデータ保全Continuous Protection

Heroku Postgres

マネージドサービスManagement Services

Postgres

拡張機能Value-Added Features

Postgres

100% 互換100% Compatibility

なぜPostgresなのか?Why Postgres?

Users Purchases

Products

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

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);

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] = qtyitems [x][2] = price

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

データ型Data types

smallint

bigint

integernumeric

floatserial

money

char

varchartext

bytea

timestamp

timestamptz

date

time timetz

intervalboolean

enumpointline

polygon

box

circle

path

inet cidrmacaddr

tsvectortsquery

array

XML

UUID

その他の言語Other languadges

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;

その他の言語Other languadges

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

その他の言語Other languadges

pythonrubypgsql

SQLtclsh

RV8Java

javascript

lolcode

scheme

php

j

luapsm

その他の言語Other languadges

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);

エクステンションExtention

INSERT INTO users VALUES (

1, 'Craig', 'Kerstiens', 'craig.kerstiens@gmail.com', 'sex => "M", state => "CA"', now(), now()

);

エクステンションExtention

エクステンションExtention

dblink hstorecitext

ltreeisncube

pgcrypto

tablefunc

uuid-ossp

earthdistance

trigram

fuzzystrmatch

pgrowlockspgstattuple

btree_gist

dict_intdict_xsynunaccent

Heroku Postgres

マネージドサービスManagement Services

Postgres

拡張機能Value-Added Features

拡張機能Value-Added Features

Data Clipsデータを共有する最も簡単な方法

The easiest way to share your data

SELECT * FROM salesWHERE amount > 1

+本番データLive Production Data

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

Forkデータベースを完全な複製を作成

A perfect, byte-for-byte clone of your database

Fork

ProductionApp

Fork

ProductionApp

Fork

ProductionApp

データの内部を安全に調査Investigate data safty

Followワンクリックでレプリケーションを作成

Read replicas with a single click

Follow

Follower 1

Follower 2

書き込みトランザクションWrite Transactions

読み出しトランザクションRead Transactions

MasterDatabase

Follower 1

Follower 2

書き込みトランザクションWrite Transactions

読み出しトランザクションRead Transactions

MasterDatabase

Follower 2

書き込みトランザクションWrite Transactions

読み出しトランザクションRead Transactions

MasterDatabase

New Master

top related