SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
9.1 Tour
   Grand

         Josh Berkus
       Postgres Open
      September 2011
Home                           Replication
                               Tools
             Synchronous
             Replication
                                         Per-Column
                                         Collations
Other
Features
                 SE-Postgres            wCTEs


Extensions                                     SSI
             K-Nearest
             Neighbor

  SQL/MED                           Unlogged
                                    Tables
Asynchronous Replication
Asynchronous Replication
Synchronous Replication
Synchronous Replication
Synchronous Replication
standby Paris:
primary_conninfo = 'host=john
 port=5432 user=replication
 application_name=paris'

master London:
synchronous_commit = on
synchronous_standby_names =
 'paris,madrid,berlin'
Synchronous Replication
postgres=# select application_name as appname, state,
sync_state, sync_priority as prty, replay_location
from pg_stat_replication;
 appname |   state   | sync_state | prty | replay_loc
---------+-----------+------------+------+------------
 paris   | STREAMING | SYNC       |    1 | 0/29154EB8
 madrid | STREAMING | POTENTIAL |      2 | 0/291452F0
 berlin | STREAMING | POTENTIAL |      3 | 0/29154EB8
Transaction Control
# set synchronous_commit = on;
# begin;

# update user_balance
# set balance = balance - 300
# where user = 14301;

# update user_balance
# set balance = balance + 300
# where user = 13221;

# commit;
Transaction Control
#    set synchronous_commit = 'local';
#    insert into user_messages
#    values ( 14301, 13221,
#    'hello a/s/l?' );




    Po
       stg
           re   sO
                     nly
                           !
New Replication Tools
●   pg_stat_replication view
    ●   shows all replicas and their statuses
●   pg_basebackup
    ●   single-command cloning over port 5432
●   re-mastering
    ●   promote a replica to be the new master
●   new functions
    ●   pg_last_xact_replay_timestamp()
    ●   pg_xlog_replay_pause()
Per-Column Collations
ID     english       日本語
787    error         エラー
12     unique        ユニークな
456    index         インデックス
333    documentation ドキュメンテーション
217    open source オープンソース
2134   penguin       ペンギン
Per-Column Collations
$ create table collated_polish (some_text
text collate "pl_PL.utf8");
$ copy collated_polish from '/tmp/polish';
$ select * from collated_polish order by
some_text;
some_text
-----------
alfa
car
co
ma
lama
ódka
mama
Land of
Surreal
Queries
Writable CTEs
WITH deleted_posts AS (
  DELETE FROM posts
  WHERE created < now()
     - '6 months'::INTERVAL
  RETURNING *
)
SELECT user_id, count(*) FROM
deleted_posts group BY 1;
Po
                                   stg
         Writable CTEs                 re   sO
                                                 nly
WITH deleted_posts AS (                                !
   DELETE FROM posts
   WHERE created < now()
      - '6 months'::INTERVAL
   RETURNING *
),
deleted_per_user as (
   SELECT user_id, count(*)
   FROM deleted_posts
   GROUP BY 1
)
UPDATE counts
SET posts_count = posts_count - d.count
FROM deleted_per_user d
WHERE d.user_id = counts.user_id;
Serialized Snapshot
               Isolation
 ●   Allows true serialization of concurrent
     transactions
 ●   No more explicit locking!
 ●   No more deadlocks!
 ●   As long as each transaction works, all will work.
Po Including limited predicate locking.
 ●

  stg
      res
          On
             ly!
See
                SSI               Th
                                    eT
update othello                           alk
set pieces =                                   !
'white' where       update othello set
pieces = 'black';   pieces = 'black'
                    where pieces =
                    'white';
                    commit;
commit;
ERROR: could not
serialize access
 due to
read/write
dependencies
among
transactions
Unlogged Tables
CREATE UNLOGGED TABLE
cleaned_log_import
AS SELECT hit_time, page
FROM raw_hits, hit_watermark
WHERE hit_time > last_watermark
  AND is_valid(page);
Po
                                                stg
                  SE-Postgres                       re   sO
                                                              nly
                                                                    !
●   Now a contrib module!
    ●   uses “hooks” enabled at build time
●   Integrates with SE-Linux
    ●   SE-Linux “security labels” become object
        permissions
    ●   covers all database object permissions
●   row-level access control not implemented yet
SE-Postgres
SE-Postgres
K-Nearest Neighbor
Po
      K-Nearest Neighbor s 1         stg
                                         re
                                              st!
SELECT *,
  position <-> $my_current_location
  as distance
FROM gelaterias
ORDER BY position <-> $my_current_location
LIMIT 3;
SQL-MED

FDR


      FDR


FDR
SQL-MED
CREATE FOREIGN TABLE raw_hits
( hit_time TIMESTAMP,
  page TEXT )
SERVER file_fdw
OPTIONS (format 'csv', delimiter
';', filename '/var/log/hits.log');
See
          SQL-MED                 the
                                        talk
                                               !

SELECT page, count(*)
FROM raw_hits
WHERE hit_time >
  '2011-04-16 16:00:00' AND
  hit_time <= '2011-04-16 17:00:00'
GROUP BY page;
Extensions
Po
                                 stg
            Extensions               re   sO
                                               nly
CREATE EXTENSION IF NOT EXISTS citext
                                                     !
WITH SCHEMA ext;

dx
Schema | Name   | Version   | Description

-------+--------+----------+------------
ext    | citext | 9.1devel | case-
       insensitive character string type
Extensions
ALTER EXTENSION citext UPDATE TO 9.2;


DROP EXTENSION citext;
Extensions
Other Features
●   PL/Python overhaul
●   Valid-on-creation Foreign Keys
●   Extensible ENUMs
●   Triggers on Views
●   New Trigram implementation
●   Reduced NUMERIC size
●   ALTER TYPE without rewrite
●   pg_dump directory format
9.1 Sessions at pgOpen
● Unlogged Tables: Friday 9:45
● Accelerating Local Search with

  PostgreSQL 9.1: Friday 9:45
● PostgreSQL at the Center of Your

  Dataverse: Friday 10:10
● True Serializable Transactions Are

  Here: Friday 11:00
Contact
●   Josh Berkus: josh@pgexperts.com
    ●   blog: blogs.ittoolbox.com/database/soup
●   PostgreSQL: www.postgresql.org
    ●   pgexperts: www.pgexperts.com
●   Upcoming Events
    ●   PostgreSQL Europe
    ●   Denver pgDay
         This talk is copyright 2011 Josh Berkus and is licensed under the creative commons attribution
         license. Special thanks for materials to: Hubert Lubaczewski (wCTE, collation examples), Andrew
         Dunstan (file_FDW)

Contenu connexe

Tendances

Automating Disaster Recovery PostgreSQL
Automating Disaster Recovery PostgreSQLAutomating Disaster Recovery PostgreSQL
Automating Disaster Recovery PostgreSQLNina Kaufman
 
Centralized + Unified Logging
Centralized + Unified LoggingCentralized + Unified Logging
Centralized + Unified LoggingGabor Kozma
 
Containers: What are they, Really?
Containers: What are they, Really?Containers: What are they, Really?
Containers: What are they, Really?Sneha Inguva
 
Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung...
Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung...Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung...
Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung...Tobias Schneck
 
In-core compression: how to shrink your database size in several times
In-core compression: how to shrink your database size in several timesIn-core compression: how to shrink your database size in several times
In-core compression: how to shrink your database size in several timesAleksander Alekseev
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPeter Eisentraut
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slidesmetsarin
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUNCong Zhang
 
Redis as a message queue
Redis as a message queueRedis as a message queue
Redis as a message queueBrandon Lamb
 
Linux shell env
Linux shell envLinux shell env
Linux shell envRahul Pola
 
Quick start bash script
Quick start   bash scriptQuick start   bash script
Quick start bash scriptSimon Su
 
Linux-Fu for PHP Developers
Linux-Fu for PHP DevelopersLinux-Fu for PHP Developers
Linux-Fu for PHP DevelopersLorna Mitchell
 
Object Storage with Gluster
Object Storage with GlusterObject Storage with Gluster
Object Storage with GlusterGluster.org
 
Performance Profiling in Rust
Performance Profiling in RustPerformance Profiling in Rust
Performance Profiling in RustInfluxData
 
Shell Scripting in Linux
Shell Scripting in LinuxShell Scripting in Linux
Shell Scripting in LinuxAnu Chaudhry
 
Fluentd unified logging layer
Fluentd   unified logging layerFluentd   unified logging layer
Fluentd unified logging layerKiyoto Tamura
 
Lua tech talk
Lua tech talkLua tech talk
Lua tech talkLocaweb
 

Tendances (20)

Automating Disaster Recovery PostgreSQL
Automating Disaster Recovery PostgreSQLAutomating Disaster Recovery PostgreSQL
Automating Disaster Recovery PostgreSQL
 
Centralized + Unified Logging
Centralized + Unified LoggingCentralized + Unified Logging
Centralized + Unified Logging
 
Containers: What are they, Really?
Containers: What are they, Really?Containers: What are they, Really?
Containers: What are they, Really?
 
Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung...
Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung...Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung...
Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung...
 
In-core compression: how to shrink your database size in several times
In-core compression: how to shrink your database size in several timesIn-core compression: how to shrink your database size in several times
In-core compression: how to shrink your database size in several times
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQL
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
 
Hypertable Nosql
Hypertable NosqlHypertable Nosql
Hypertable Nosql
 
Redis as a message queue
Redis as a message queueRedis as a message queue
Redis as a message queue
 
Linux shell env
Linux shell envLinux shell env
Linux shell env
 
Quick start bash script
Quick start   bash scriptQuick start   bash script
Quick start bash script
 
Linux-Fu for PHP Developers
Linux-Fu for PHP DevelopersLinux-Fu for PHP Developers
Linux-Fu for PHP Developers
 
Linux Containers (LXC)
Linux Containers (LXC)Linux Containers (LXC)
Linux Containers (LXC)
 
Shell programming
Shell programmingShell programming
Shell programming
 
Object Storage with Gluster
Object Storage with GlusterObject Storage with Gluster
Object Storage with Gluster
 
Performance Profiling in Rust
Performance Profiling in RustPerformance Profiling in Rust
Performance Profiling in Rust
 
Shell Scripting in Linux
Shell Scripting in LinuxShell Scripting in Linux
Shell Scripting in Linux
 
Fluentd unified logging layer
Fluentd   unified logging layerFluentd   unified logging layer
Fluentd unified logging layer
 
Lua tech talk
Lua tech talkLua tech talk
Lua tech talk
 

En vedette

Grand tour presentation
Grand tour presentationGrand tour presentation
Grand tour presentationkrpenna
 
Europe maps 1200 2000
Europe maps 1200 2000Europe maps 1200 2000
Europe maps 1200 2000Mike Arguello
 
Farming Unicorns: Building Startup & Investor Ecosystems
Farming Unicorns: Building Startup & Investor EcosystemsFarming Unicorns: Building Startup & Investor Ecosystems
Farming Unicorns: Building Startup & Investor EcosystemsDave McClure
 

En vedette (6)

Neoclassicismo 2C26
Neoclassicismo 2C26Neoclassicismo 2C26
Neoclassicismo 2C26
 
The Grand Tour
The  Grand  TourThe  Grand  Tour
The Grand Tour
 
Grand tour presentation
Grand tour presentationGrand tour presentation
Grand tour presentation
 
Europe maps 1200 2000
Europe maps 1200 2000Europe maps 1200 2000
Europe maps 1200 2000
 
O neoclassicismo arquitetura
O neoclassicismo arquiteturaO neoclassicismo arquitetura
O neoclassicismo arquitetura
 
Farming Unicorns: Building Startup & Investor Ecosystems
Farming Unicorns: Building Startup & Investor EcosystemsFarming Unicorns: Building Startup & Investor Ecosystems
Farming Unicorns: Building Startup & Investor Ecosystems
 

Similaire à 9.1 Grand Tour

Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Michael Renner
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Prajal Kulkarni
 
Getting Started with PL/Proxy
Getting Started with PL/ProxyGetting Started with PL/Proxy
Getting Started with PL/ProxyPeter Eisentraut
 
PostgreSQL 8.4 TriLUG 2009-11-12
PostgreSQL 8.4 TriLUG 2009-11-12PostgreSQL 8.4 TriLUG 2009-11-12
PostgreSQL 8.4 TriLUG 2009-11-12Andrew Dunstan
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Denish Patel
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Denish Patel
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Denish Patel
 
plProxy, pgBouncer, pgBalancer
plProxy, pgBouncer, pgBalancerplProxy, pgBouncer, pgBalancer
plProxy, pgBouncer, pgBalancerelliando dias
 
Streaming replication in practice
Streaming replication in practiceStreaming replication in practice
Streaming replication in practiceAlexey Lesovsky
 
CoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdCoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdRichard Lister
 
Quantifying Container Runtime Performance: OSCON 2017 Open Container Day
Quantifying Container Runtime Performance: OSCON 2017 Open Container DayQuantifying Container Runtime Performance: OSCON 2017 Open Container Day
Quantifying Container Runtime Performance: OSCON 2017 Open Container DayPhil Estes
 
PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개PgDay.Seoul
 
Developing with-devstack
Developing with-devstackDeveloping with-devstack
Developing with-devstackDeepak Garg
 
Docker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12XDocker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12XJérôme Petazzoni
 
Introduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System AdministratorsIntroduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System AdministratorsJignesh Shah
 
10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQLSatoshi Nagayasu
 

Similaire à 9.1 Grand Tour (20)

Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 
Plproxy
PlproxyPlproxy
Plproxy
 
8.4 Upcoming Features
8.4 Upcoming Features 8.4 Upcoming Features
8.4 Upcoming Features
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.
 
Getting Started with PL/Proxy
Getting Started with PL/ProxyGetting Started with PL/Proxy
Getting Started with PL/Proxy
 
PostgreSQL 8.4 TriLUG 2009-11-12
PostgreSQL 8.4 TriLUG 2009-11-12PostgreSQL 8.4 TriLUG 2009-11-12
PostgreSQL 8.4 TriLUG 2009-11-12
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4
 
plProxy, pgBouncer, pgBalancer
plProxy, pgBouncer, pgBalancerplProxy, pgBouncer, pgBalancer
plProxy, pgBouncer, pgBalancer
 
Streaming replication in practice
Streaming replication in practiceStreaming replication in practice
Streaming replication in practice
 
CoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdCoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love Systemd
 
Quantifying Container Runtime Performance: OSCON 2017 Open Container Day
Quantifying Container Runtime Performance: OSCON 2017 Open Container DayQuantifying Container Runtime Performance: OSCON 2017 Open Container Day
Quantifying Container Runtime Performance: OSCON 2017 Open Container Day
 
PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개
 
Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
 
The Accidental DBA
The Accidental DBAThe Accidental DBA
The Accidental DBA
 
Developing with-devstack
Developing with-devstackDeveloping with-devstack
Developing with-devstack
 
Docker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12XDocker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12X
 
Introduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System AdministratorsIntroduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System Administrators
 
10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL
 

Plus de PostgreSQL Experts, Inc.

PostgreSQL Replication in 10 Minutes - SCALE
PostgreSQL Replication in 10  Minutes - SCALEPostgreSQL Replication in 10  Minutes - SCALE
PostgreSQL Replication in 10 Minutes - SCALEPostgreSQL Experts, Inc.
 
Elephant Roads: PostgreSQL Patches and Variants
Elephant Roads: PostgreSQL Patches and VariantsElephant Roads: PostgreSQL Patches and Variants
Elephant Roads: PostgreSQL Patches and VariantsPostgreSQL Experts, Inc.
 

Plus de PostgreSQL Experts, Inc. (20)

Shootout at the PAAS Corral
Shootout at the PAAS CorralShootout at the PAAS Corral
Shootout at the PAAS Corral
 
Shootout at the AWS Corral
Shootout at the AWS CorralShootout at the AWS Corral
Shootout at the AWS Corral
 
Fail over fail_back
Fail over fail_backFail over fail_back
Fail over fail_back
 
PostgreSQL Replication in 10 Minutes - SCALE
PostgreSQL Replication in 10  Minutes - SCALEPostgreSQL Replication in 10  Minutes - SCALE
PostgreSQL Replication in 10 Minutes - SCALE
 
HowTo DR
HowTo DRHowTo DR
HowTo DR
 
Give A Great Tech Talk 2013
Give A Great Tech Talk 2013Give A Great Tech Talk 2013
Give A Great Tech Talk 2013
 
Pg py-and-squid-pypgday
Pg py-and-squid-pypgdayPg py-and-squid-pypgday
Pg py-and-squid-pypgday
 
92 grand prix_2013
92 grand prix_201392 grand prix_2013
92 grand prix_2013
 
Five steps perform_2013
Five steps perform_2013Five steps perform_2013
Five steps perform_2013
 
7 Ways To Crash Postgres
7 Ways To Crash Postgres7 Ways To Crash Postgres
7 Ways To Crash Postgres
 
PWNage: Producing a newsletter with Perl
PWNage: Producing a newsletter with PerlPWNage: Producing a newsletter with Perl
PWNage: Producing a newsletter with Perl
 
10 Ways to Destroy Your Community
10 Ways to Destroy Your Community10 Ways to Destroy Your Community
10 Ways to Destroy Your Community
 
Open Source Press Relations
Open Source Press RelationsOpen Source Press Relations
Open Source Press Relations
 
5 (more) Ways To Destroy Your Community
5 (more) Ways To Destroy Your Community5 (more) Ways To Destroy Your Community
5 (more) Ways To Destroy Your Community
 
Preventing Community (from Linux Collab)
Preventing Community (from Linux Collab)Preventing Community (from Linux Collab)
Preventing Community (from Linux Collab)
 
Development of 8.3 In India
Development of 8.3 In IndiaDevelopment of 8.3 In India
Development of 8.3 In India
 
PostgreSQL and MySQL
PostgreSQL and MySQLPostgreSQL and MySQL
PostgreSQL and MySQL
 
50 Ways To Love Your Project
50 Ways To Love Your Project50 Ways To Love Your Project
50 Ways To Love Your Project
 
Elephant Roads: PostgreSQL Patches and Variants
Elephant Roads: PostgreSQL Patches and VariantsElephant Roads: PostgreSQL Patches and Variants
Elephant Roads: PostgreSQL Patches and Variants
 
Writeable CTEs: The Next Big Thing
Writeable CTEs: The Next Big ThingWriteable CTEs: The Next Big Thing
Writeable CTEs: The Next Big Thing
 

Dernier

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Dernier (20)

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

9.1 Grand Tour

  • 1. 9.1 Tour Grand Josh Berkus Postgres Open September 2011
  • 2. Home Replication Tools Synchronous Replication Per-Column Collations Other Features SE-Postgres wCTEs Extensions SSI K-Nearest Neighbor SQL/MED Unlogged Tables
  • 7. Synchronous Replication standby Paris: primary_conninfo = 'host=john port=5432 user=replication application_name=paris' master London: synchronous_commit = on synchronous_standby_names = 'paris,madrid,berlin'
  • 8. Synchronous Replication postgres=# select application_name as appname, state, sync_state, sync_priority as prty, replay_location from pg_stat_replication; appname | state | sync_state | prty | replay_loc ---------+-----------+------------+------+------------ paris | STREAMING | SYNC | 1 | 0/29154EB8 madrid | STREAMING | POTENTIAL | 2 | 0/291452F0 berlin | STREAMING | POTENTIAL | 3 | 0/29154EB8
  • 9. Transaction Control # set synchronous_commit = on; # begin; # update user_balance # set balance = balance - 300 # where user = 14301; # update user_balance # set balance = balance + 300 # where user = 13221; # commit;
  • 10. Transaction Control # set synchronous_commit = 'local'; # insert into user_messages # values ( 14301, 13221, # 'hello a/s/l?' ); Po stg re sO nly !
  • 11. New Replication Tools ● pg_stat_replication view ● shows all replicas and their statuses ● pg_basebackup ● single-command cloning over port 5432 ● re-mastering ● promote a replica to be the new master ● new functions ● pg_last_xact_replay_timestamp() ● pg_xlog_replay_pause()
  • 12. Per-Column Collations ID english 日本語 787 error エラー 12 unique ユニークな 456 index インデックス 333 documentation ドキュメンテーション 217 open source オープンソース 2134 penguin ペンギン
  • 13. Per-Column Collations $ create table collated_polish (some_text text collate "pl_PL.utf8"); $ copy collated_polish from '/tmp/polish'; $ select * from collated_polish order by some_text; some_text ----------- alfa car co ma lama ódka mama
  • 15. Writable CTEs WITH deleted_posts AS ( DELETE FROM posts WHERE created < now() - '6 months'::INTERVAL RETURNING * ) SELECT user_id, count(*) FROM deleted_posts group BY 1;
  • 16. Po stg Writable CTEs re sO nly WITH deleted_posts AS ( ! DELETE FROM posts WHERE created < now() - '6 months'::INTERVAL RETURNING * ), deleted_per_user as ( SELECT user_id, count(*) FROM deleted_posts GROUP BY 1 ) UPDATE counts SET posts_count = posts_count - d.count FROM deleted_per_user d WHERE d.user_id = counts.user_id;
  • 17. Serialized Snapshot Isolation ● Allows true serialization of concurrent transactions ● No more explicit locking! ● No more deadlocks! ● As long as each transaction works, all will work. Po Including limited predicate locking. ● stg res On ly!
  • 18. See SSI Th eT update othello alk set pieces = ! 'white' where update othello set pieces = 'black'; pieces = 'black' where pieces = 'white'; commit; commit; ERROR: could not serialize access due to read/write dependencies among transactions
  • 19. Unlogged Tables CREATE UNLOGGED TABLE cleaned_log_import AS SELECT hit_time, page FROM raw_hits, hit_watermark WHERE hit_time > last_watermark AND is_valid(page);
  • 20. Po stg SE-Postgres re sO nly ! ● Now a contrib module! ● uses “hooks” enabled at build time ● Integrates with SE-Linux ● SE-Linux “security labels” become object permissions ● covers all database object permissions ● row-level access control not implemented yet
  • 24. Po K-Nearest Neighbor s 1 stg re st! SELECT *, position <-> $my_current_location as distance FROM gelaterias ORDER BY position <-> $my_current_location LIMIT 3;
  • 25. SQL-MED FDR FDR FDR
  • 26. SQL-MED CREATE FOREIGN TABLE raw_hits ( hit_time TIMESTAMP, page TEXT ) SERVER file_fdw OPTIONS (format 'csv', delimiter ';', filename '/var/log/hits.log');
  • 27. See SQL-MED the talk ! SELECT page, count(*) FROM raw_hits WHERE hit_time > '2011-04-16 16:00:00' AND hit_time <= '2011-04-16 17:00:00' GROUP BY page;
  • 29. Po stg Extensions re sO nly CREATE EXTENSION IF NOT EXISTS citext ! WITH SCHEMA ext; dx Schema | Name | Version | Description -------+--------+----------+------------ ext | citext | 9.1devel | case- insensitive character string type
  • 30. Extensions ALTER EXTENSION citext UPDATE TO 9.2; DROP EXTENSION citext;
  • 32. Other Features ● PL/Python overhaul ● Valid-on-creation Foreign Keys ● Extensible ENUMs ● Triggers on Views ● New Trigram implementation ● Reduced NUMERIC size ● ALTER TYPE without rewrite ● pg_dump directory format
  • 33. 9.1 Sessions at pgOpen ● Unlogged Tables: Friday 9:45 ● Accelerating Local Search with PostgreSQL 9.1: Friday 9:45 ● PostgreSQL at the Center of Your Dataverse: Friday 10:10 ● True Serializable Transactions Are Here: Friday 11:00
  • 34. Contact ● Josh Berkus: josh@pgexperts.com ● blog: blogs.ittoolbox.com/database/soup ● PostgreSQL: www.postgresql.org ● pgexperts: www.pgexperts.com ● Upcoming Events ● PostgreSQL Europe ● Denver pgDay This talk is copyright 2011 Josh Berkus and is licensed under the creative commons attribution license. Special thanks for materials to: Hubert Lubaczewski (wCTE, collation examples), Andrew Dunstan (file_FDW)