SlideShare une entreprise Scribd logo
1  sur  38
Télécharger pour lire hors ligne
PostgreSQL 9.0

  Selena Deckelmann
selenamarie@gmail.com

   PDXPUG Day 2010


    July 18, 2010
Many thanks to:

    Mark Wong
markwkm@gmail.com

   Gabrielle Roth
 gorthx@gmail.com
Introductions




             __      __
            / ~~~/  . o O ( PostgreSQL? )
      ,----(      oo    )
     /      __      __/
    /|          ( |(
   ^    /___ / |
      |__|   |__|-"
PostgreSQL




    - Current version 8.4.4
    - 9.0 is in Beta
    - Release in August?
    - Get it here:
      http://www.postgresql.org/ftp/source/9.0beta3/
      http://www.postgresql.org/developer/beta
Contents




   Full list of features:
   http://developer.postgresql.org/pgdocs/postgres/
   release-9-0.html
To boldly go...


   ___________________          _-_
   __(==========/_=_/ ____.---’---‘---.____
               _     ----._________.----/
                     / /     ‘-_-’
             __,--‘.‘-’..’-_
            /____          ||
                 ‘--.____,-’




    Based on overwhelming user demand, this release of PostgreSQL
    adds features that have been requested for years, like easy-to-use
   replication, a mass permission facility, and anonymous code blocks.
Seriously. It’s a big release




      - New feature patches: 204
      - Submitters: 84
      - 2189 files changed, 214227 insertions(+), 125369 deletions(-)
Add the ability to make mass permission changes per
schema using the new GRANT/REVOKE IN SCHEMA
clause (Petr Jelinek)




   postgres# GRANT SELECT,INSERT,UPDATE ON
             ALL TABLES IN SCHEMA conference TO selena;
Add ALTER DEFAULT PRIVILEGES command to control
privileges of newly-created objects (Petr Jelinek)




  postgres# ALTER DEFAULT PRIVILEGES
     IN SCHEMA conference
     GRANT INSERT ON TABLES TO selena;

  Use psql’s ddp command to get info about
  existing assignments of default privileges.
Install server-side language PL/pgSQL by default (Bruce
Momjian)




                             Yes.

   Also recall: CREATE [ OR REPLACE ] [ PROCEDURAL ]
   LANGUAGE name
Implement anonymous functions using the DO statement,
a.k.a anonymous blocks (Petr Jelinek, Joshua Tolley,
Hannu Valtonen)



   DO $$
   BEGIN
     FOR x IN 1..10 LOOP
         RAISE NOTICE ’Now at %’, x;
     END LOOP;
   END;$$;
More DO...




  DO $$
  for i in range(10):
     plpy.notice(i)
  $$ language ’plpythonu’;
MOAR DO...


  DO $$
  HAI
      I HAS A VAR ITZ 0
      IM IN YR LOOP
          VAR R SUM OF VAR AN 1
          VISIBLE VAR
          BOTH SAEM VAR AN 10, O RLY?
              YA RLY, GTFO
          OIC
      IM OUTTA YR LOOP
  KTHXBYE
  $$ language ’pllolcode’;
Allow function calls to supply parameter names and match
them to named parameters in the function definition
(Pavel Stehule)




   (Demo.)
Add support for to char() scientific notation output
(’EEEE’) (Pavel Stehule, Brendan Jurd)

   postgres=# create table exponents_demo
   (example numeric);
   CREATE TABLE
   postgres=# INSERT INTO exponents_demo
   VALUES
     (’10000000’),
     (’2.54’),
     (’3.1415’),
     (’666’),
     (’6.02e+23’),
     (’5.29e-11’),
     (’8675309’)
   ;
Con’t


   postgres=# SELECT * from exponents_demo ;
          example
   --------------------------
                    10000000
                        2.54
                      3.1415
                         666
    602000000000000000000000
             0.0000000000529
                     8675309
   (7 rows)
Con’t


   postgres=# SELECT to_char(example, ’9.9EEEE’)
   AS lookyhere
   FROM exponents_demo ;
    lookyhere
   -----------
     1.0e+07
     2.5e+00
     3.1e+00
     6.7e+02
     6.0e+23
     5.3e-11
     8.7e+06
   (7 rows)
RADIUS Authentication (Magnus Hagander)




  #host database user CIDR-address auth-method [auth-opt
  host   all       all   0.0.0.0/0     radius       
  radiusserver=1.2.3.4 radiussecret=canttouchthis 
  radiusport=1234 radiusidentifier=gabscooldatabase
Add samehost and samenet designations to pg hba.conf
(Stef Walter)




   # IPv4 local connections:
   host all all              127.0.0.1/32       md5
   host all all              samehost           md5
   host all all              samenet            md5
Log changed parameter values when postgresql.conf is
reloaded (Peter Eisentraut)



   LOG: parameter "log_rotation_age" changed to "7d"
   LOG: parameter "port" cannot be changed without restarting
   LOG: parameter "log_rotation_age" changed to "1d"
   LOG: parameter "log_min_messages" changed to "notice"
   LOG: parameter "autovacuum" changed to "off"
   <2010-04-22 14:00:50 PDT >LOG: parameter "log_line_prefix
   <2010-04-22 14:00:50 PDT >LOG: parameter "log_statement"
Add an SQL state option (%e) to log line prefix
(Guillaume Smet)

   e.g.:

   log_line_prefix = ’<%t %d %u %e>’


   gives you something like:

   <2010-04-22 21:02:02 PDT postgres postgres 00000> 
    LOG: statement: ALTER TABLE drop_column_demo DROP COLUMN
   <2010-04-22 21:02:54 PDT postgres postgres 00000> 
    LOG: statement: GRANT SELECT on drop_column_demo to groth
   <2010-04-22 21:02:54 PDT postgres postgres 42704> 
    ERROR: role "groth" does not exist
Add new EXPLAIN (BUFFERS) to report query buffer
activity (Itagaki Takahiro)

  # EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM
  pg_attribute;
                                                    QUERY PLA
  -----------------------------------------------------------
   Seq Scan on pg_attribute (cost=0.00..52.35 rows=1935 widt
  (actual time=0.010..0.948 rows=1935 loops=1)
     Buffers: shared hit=16 read=17
   Total runtime: 1.841 ms
  (3 rows)

  selena@postgres:5432=# EXPLAIN (ANALYZE, BUFFERS) SELECT *
  -----------------------------------------------------------
   Seq Scan on pg_attribute (cost=0.00..52.35 rows=1935 widt
  (actual time=0.010..0.589 rows=1935 loops=1)
     Buffers: shared hit=33
   Total runtime: 0.992 ms
Allow EXPLAIN output in XML, JSON, and YAML
formats (Robert Haas, Greg Sabino Mullane)



  EXPLAIN
  SELECT * FROM user_history ORDER BY "timestamp";
  QUERY PLAN
  -----------------------------------------------------------
   Sort (cost=18494.32..18852.33 rows=143204 width=34)
     Sort Key: "timestamp"
     -> Seq Scan on user_history (cost=0.00..2559.04 rows=1
  (3 rows)
Con’t

   EXPLAIN (FORMAT XML)
   SELECT * FROM user_history ORDER BY "timestamp";
   QUERY PLAN
   -----------------------------------------------------------
   <explain xmlns="http://www.postgresql.org/2009/explain"> +
     <Query>                                                 +
       <Plan>                                                +
         <Node-Type>Sort</Node-Type>                         +
         <Startup-Cost>18494.32</Startup-Cost>               +
         <Total-Cost>18852.33</Total-Cost>                   +
         <Plan-Rows>143204</Plan-Rows>                       +
         <Plan-Width>34</Plan-Width>                         +
         <Sort-Key>                                          +
           <Item>"timestamp"</Item>                          +
         </Sort-Key>                                         +
   ...
Con’t

   ...
         <Plans>                                             +
           <Plan>                                            +
             <Node-Type>Seq Scan</Node-Type>                 +
             <Parent-Relationship>Outer</Parent-Relationship>+
             <Relation-Name>user_history</Relation-Name>     +
             <Alias>user_history</Alias>                     +
             <Startup-Cost>0.00</Startup-Cost>               +
             <Total-Cost>2559.04</Total-Cost>                +
             <Plan-Rows>143204</Plan-Rows>                   +
             <Plan-Width>34</Plan-Width>                     +
           </Plan>                                           +
         </Plans>                                            +
       </Plan>                                               +
     </Query>                                                +
   </explain>
   (1 row)
Con’t


   EXPLAIN (FORMAT YAML)
   SELECT * FROM user_history ORDER BY "timestamp";
   QUERY PLAN
   -------------------------------------
    - Plan:                            +
        Node Type: Sort                +
        Startup Cost: 18494.32         +
        Total Cost: 18852.33           +
        Plan Rows: 143204              +
        Plan Width: 34                 +
        Sort Key:                      +
          - ""timestamp""            +
   ...
Con’t



        Plans:                         +
          - Node Type: Seq Scan        +
            Parent Relationship: Outer +
            Relation Name: user_history+
            Alias: user_history        +
            Startup Cost: 0.00         +
            Total Cost: 2559.04        +
            Plan Rows: 143204          +
            Plan Width: 34
   (1 row)
Add WHEN clause to CREATE TRIGGER to allow control
over whether a trigger is fired (Takahiro Itagaki)




  CREATE TRIGGER name { BEFORE | AFTER } { event [ OR ... ] }
      ON table [ FOR [ EACH ] { ROW | STATEMENT } ]
      [ WHEN ( condition ) ]
      EXECUTE PROCEDURE function_name ( arguments )
Allow NOTIFY to pass an optional string to listeners
(Joachim Wieland)



   lfnw-9.0=# LISTEN l9_0;
   LISTEN
   lfnw-9.0=# NOTIFY l9_0, ’need coffee...’;
   NOTIFY
   Asynchronous notification "l9_0"
   with payload "need coffee..."
   received from server process with PID 10480.


   Also, now in-memory (faster!)
Have columns defined with storage type MAIN remain on
the main heap page unless it cannot fit (Kevin Grittner)




   8k page size
   Before: a tuple might get TOAST’d prematurely
   LIVE DEMO!
Add pg stat reset single table counters() and
pg stat reset single function counters() to allow the
resetting of statistics counters for individual tables and
indexes (Magnus Hagander)




   (Discuss.)
Add pg last xlog receive location() and
pg last xlog replay location(), which can be used to
monitor standby server WAL activity (Simon, Fujii Masao,
Heikki)




   (Discuss.)
Hot Standby/Streaming Replication




   . . . drumroll . . .
And now for something completely different...




                   Pg Android App Contest!

   http://wiki.postgresql.org/wiki/AndroidAppContest
Odds & Ends

     VACUUM FULL is dead! Long live VACUUM FULL (like
     CLUSTER).
     Add deferrable unique constraints (Dean Rasheed)
     vacuumdb –analyze-only (Bruce Momjian)
     GRANT/REVOKE IN SCHEMA (Petr Jelinek)
     pg table size and pg indexes size (Bernd Helmle)
     Remove the use of flat files for system table bootstrapping
     (Tom, Alvaro)
     DROP COLUMN IF EXISTS (Andreas Freund)
     64-bit Windows support (Tsutomu Yamada, Magnus
     Hagander)
     Improvements to PL/Perl (Tim Bunce)
     /contrib/passwordcheck (Laurenz Albe)
Final Notes




   These slides:
        http://www.slideshare.net/selenamarie
   Try it!
        http://www.postgresql.org/ftp/source/9.0beta3/
        http://www.postgresql.org/developer/beta
        http://wiki.postgresql.org/wiki/HowToBetaTest
Acknowledgements


  Gabrielle Roth
  Mark Wong
  Magnus Hagander
  Hayley Jane Wakenshaw

            __      __
           / ~~~/  . o O ( Thank you! )
     ,----(      oo    )
    /      __      __/
   /|          ( |(
  ^    /___ / |
     |__|   |__|-"
License




   This work is licensed under a Creative Commons Attribution 3.0
   Unported License. To view a copy of this license, (a) visit
   http://creativecommons.org/licenses/by/3.0/us/; or, (b)
   send a letter to Creative Commons, 171 2nd Street, Suite 300, San
   Francisco, California, 94105, USA.

Contenu connexe

Tendances

The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180Mahmoud Samir Fayed
 
SCALE 15x Minimizing PostgreSQL Major Version Upgrade Downtime
SCALE 15x Minimizing PostgreSQL Major Version Upgrade DowntimeSCALE 15x Minimizing PostgreSQL Major Version Upgrade Downtime
SCALE 15x Minimizing PostgreSQL Major Version Upgrade DowntimeJeff Frost
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeMongoDB
 
mobl - model-driven engineering lecture
mobl - model-driven engineering lecturemobl - model-driven engineering lecture
mobl - model-driven engineering lecturezefhemel
 
Python Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland
 
Modern technologies in data science
Modern technologies in data science Modern technologies in data science
Modern technologies in data science Chucheng Hsieh
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)MongoSF
 
Intro to OTP in Elixir
Intro to OTP in ElixirIntro to OTP in Elixir
Intro to OTP in ElixirJesse Anderson
 
MySQL's JSON Data Type and Document Store
MySQL's JSON Data Type and Document StoreMySQL's JSON Data Type and Document Store
MySQL's JSON Data Type and Document StoreDave Stokes
 
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQAFest
 
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀EXEM
 
Intro to Cassandra
Intro to CassandraIntro to Cassandra
Intro to CassandraTyler Hobbs
 
Flashback (Practical Test)
Flashback (Practical Test)Flashback (Practical Test)
Flashback (Practical Test)Anar Godjaev
 
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークTsuyoshi Yamamoto
 
SWP - A Generic Language Parser
SWP - A Generic Language ParserSWP - A Generic Language Parser
SWP - A Generic Language Parserkamaelian
 

Tendances (20)

Five
FiveFive
Five
 
The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180
 
SCALE 15x Minimizing PostgreSQL Major Version Upgrade Downtime
SCALE 15x Minimizing PostgreSQL Major Version Upgrade DowntimeSCALE 15x Minimizing PostgreSQL Major Version Upgrade Downtime
SCALE 15x Minimizing PostgreSQL Major Version Upgrade Downtime
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
 
mobl - model-driven engineering lecture
mobl - model-driven engineering lecturemobl - model-driven engineering lecture
mobl - model-driven engineering lecture
 
Python Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit Testing
 
Modern technologies in data science
Modern technologies in data science Modern technologies in data science
Modern technologies in data science
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
 
Javascript
JavascriptJavascript
Javascript
 
Intro to OTP in Elixir
Intro to OTP in ElixirIntro to OTP in Elixir
Intro to OTP in Elixir
 
はじめてのGroovy
はじめてのGroovyはじめてのGroovy
はじめてのGroovy
 
Dun ddd
Dun dddDun ddd
Dun ddd
 
MySQL's JSON Data Type and Document Store
MySQL's JSON Data Type and Document StoreMySQL's JSON Data Type and Document Store
MySQL's JSON Data Type and Document Store
 
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
 
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
 
Intro to Cassandra
Intro to CassandraIntro to Cassandra
Intro to Cassandra
 
Flashback (Practical Test)
Flashback (Practical Test)Flashback (Practical Test)
Flashback (Practical Test)
 
Codigos
CodigosCodigos
Codigos
 
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトーク
 
SWP - A Generic Language Parser
SWP - A Generic Language ParserSWP - A Generic Language Parser
SWP - A Generic Language Parser
 

En vedette

O que aconteceu com os mundos virtuais no ensino?
O que aconteceu com os mundos virtuais no ensino?O que aconteceu com os mundos virtuais no ensino?
O que aconteceu com os mundos virtuais no ensino?Neli Maria Mengalli
 
Estoesnieve
EstoesnieveEstoesnieve
Estoesnievenonnon
 
Max Hachenburg
Max HachenburgMax Hachenburg
Max HachenburgMsSchool
 
HAPPY CHRISTMAS
HAPPY CHRISTMASHAPPY CHRISTMAS
HAPPY CHRISTMASZAKIR
 
La2 Comp System1
La2 Comp System1La2 Comp System1
La2 Comp System1Cma Mohd
 
Polovinka Lm Prezentacia Uchenicheckaya Geneticheski Modificirovannie Organizmi
Polovinka Lm  Prezentacia Uchenicheckaya Geneticheski Modificirovannie OrganizmiPolovinka Lm  Prezentacia Uchenicheckaya Geneticheski Modificirovannie Organizmi
Polovinka Lm Prezentacia Uchenicheckaya Geneticheski Modificirovannie OrganizmiLarisaMP
 
Urok tolerantnosti
Urok tolerantnostiUrok tolerantnosti
Urok tolerantnostiritari68
 
Edvard Peter
Edvard PeterEdvard Peter
Edvard Petereka
 
Aviaq P
Aviaq PAviaq P
Aviaq Peka
 
Nina
NinaNina
Ninaeka
 
Metodika MV ČR PRINCeGON
Metodika MV ČR PRINCeGONMetodika MV ČR PRINCeGON
Metodika MV ČR PRINCeGONEquica
 
FATC UK - Real time collaborative Flex apps
FATC UK - Real time collaborative Flex appsFATC UK - Real time collaborative Flex apps
FATC UK - Real time collaborative Flex appsMichael Chaize
 

En vedette (19)

O que aconteceu com os mundos virtuais no ensino?
O que aconteceu com os mundos virtuais no ensino?O que aconteceu com os mundos virtuais no ensino?
O que aconteceu com os mundos virtuais no ensino?
 
Estoesnieve
EstoesnieveEstoesnieve
Estoesnieve
 
IEforQD
IEforQDIEforQD
IEforQD
 
WWF Advertising
WWF AdvertisingWWF Advertising
WWF Advertising
 
Handpaintings
HandpaintingsHandpaintings
Handpaintings
 
Max Hachenburg
Max HachenburgMax Hachenburg
Max Hachenburg
 
HAPPY CHRISTMAS
HAPPY CHRISTMASHAPPY CHRISTMAS
HAPPY CHRISTMAS
 
KM Postcards
KM PostcardsKM Postcards
KM Postcards
 
La2 Comp System1
La2 Comp System1La2 Comp System1
La2 Comp System1
 
Why Gerund
Why GerundWhy Gerund
Why Gerund
 
Polovinka Lm Prezentacia Uchenicheckaya Geneticheski Modificirovannie Organizmi
Polovinka Lm  Prezentacia Uchenicheckaya Geneticheski Modificirovannie OrganizmiPolovinka Lm  Prezentacia Uchenicheckaya Geneticheski Modificirovannie Organizmi
Polovinka Lm Prezentacia Uchenicheckaya Geneticheski Modificirovannie Organizmi
 
Urok tolerantnosti
Urok tolerantnostiUrok tolerantnosti
Urok tolerantnosti
 
Edvard Peter
Edvard PeterEdvard Peter
Edvard Peter
 
Aviaq P
Aviaq PAviaq P
Aviaq P
 
Dialog
DialogDialog
Dialog
 
Nina
NinaNina
Nina
 
Role of Certification Authority in E-Commerce
Role of Certification Authority in E-CommerceRole of Certification Authority in E-Commerce
Role of Certification Authority in E-Commerce
 
Metodika MV ČR PRINCeGON
Metodika MV ČR PRINCeGONMetodika MV ČR PRINCeGON
Metodika MV ČR PRINCeGON
 
FATC UK - Real time collaborative Flex apps
FATC UK - Real time collaborative Flex appsFATC UK - Real time collaborative Flex apps
FATC UK - Real time collaborative Flex apps
 

Similaire à Pdxpugday2010 pg90

Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQLPeter Eisentraut
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomyDongmin Yu
 
PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개PgDay.Seoul
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesOdoo
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak PROIDEA
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonAlex Payne
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
Performance Tuning Using oratop
Performance Tuning Using oratop Performance Tuning Using oratop
Performance Tuning Using oratop Sandesh Rao
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeWim Godden
 
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloadingkinan keshkeh
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for CassandraEdward Capriolo
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"DataStax Academy
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기NAVER D2
 
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...Big Data Spain
 

Similaire à Pdxpugday2010 pg90 (20)

Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomy
 
Explain this!
Explain this!Explain this!
Explain this!
 
PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance Issues
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the Horizon
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Performance Tuning Using oratop
Performance Tuning Using oratop Performance Tuning Using oratop
Performance Tuning Using oratop
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the code
 
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기
 
Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
 
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
 
Groovy
GroovyGroovy
Groovy
 

Plus de Selena Deckelmann

While we're here, let's fix computer science education
While we're here, let's fix computer science educationWhile we're here, let's fix computer science education
While we're here, let's fix computer science educationSelena Deckelmann
 
Mistakes were made - LCA 2012
Mistakes were made - LCA 2012Mistakes were made - LCA 2012
Mistakes were made - LCA 2012Selena Deckelmann
 
Postgres needs an aircraft carrier
Postgres needs an aircraft carrierPostgres needs an aircraft carrier
Postgres needs an aircraft carrierSelena Deckelmann
 
Harder, better, faster, stronger: PostgreSQL 9.1
Harder, better, faster, stronger: PostgreSQL 9.1Harder, better, faster, stronger: PostgreSQL 9.1
Harder, better, faster, stronger: PostgreSQL 9.1Selena Deckelmann
 
Letters from the open source trenches - Postgres community
Letters from the open source trenches - Postgres communityLetters from the open source trenches - Postgres community
Letters from the open source trenches - Postgres communitySelena Deckelmann
 
Own it: working with a changing open source community
Own it: working with a changing open source communityOwn it: working with a changing open source community
Own it: working with a changing open source communitySelena Deckelmann
 
Managing terabytes: When Postgres gets big
Managing terabytes: When Postgres gets bigManaging terabytes: When Postgres gets big
Managing terabytes: When Postgres gets bigSelena Deckelmann
 
Managing terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets bigManaging terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets bigSelena Deckelmann
 
How a bunch of normal people Used Technology To Repair a Rigged Election
How a bunch of normal people Used Technology To Repair a Rigged ElectionHow a bunch of normal people Used Technology To Repair a Rigged Election
How a bunch of normal people Used Technology To Repair a Rigged ElectionSelena Deckelmann
 
Open Source Bridge Opening Day
Open Source Bridge Opening DayOpen Source Bridge Opening Day
Open Source Bridge Opening DaySelena Deckelmann
 

Plus de Selena Deckelmann (20)

While we're here, let's fix computer science education
While we're here, let's fix computer science educationWhile we're here, let's fix computer science education
While we're here, let's fix computer science education
 
Algorithms are Recipes
Algorithms are RecipesAlgorithms are Recipes
Algorithms are Recipes
 
Hire the right way
Hire the right wayHire the right way
Hire the right way
 
Mistakes were made - LCA 2012
Mistakes were made - LCA 2012Mistakes were made - LCA 2012
Mistakes were made - LCA 2012
 
Pg92 HA, LCA 2012, Ballarat
Pg92 HA, LCA 2012, BallaratPg92 HA, LCA 2012, Ballarat
Pg92 HA, LCA 2012, Ballarat
 
Managing terabytes
Managing terabytesManaging terabytes
Managing terabytes
 
Mistakes were made
Mistakes were madeMistakes were made
Mistakes were made
 
Postgres needs an aircraft carrier
Postgres needs an aircraft carrierPostgres needs an aircraft carrier
Postgres needs an aircraft carrier
 
Mistakes were made
Mistakes were madeMistakes were made
Mistakes were made
 
Harder, better, faster, stronger: PostgreSQL 9.1
Harder, better, faster, stronger: PostgreSQL 9.1Harder, better, faster, stronger: PostgreSQL 9.1
Harder, better, faster, stronger: PostgreSQL 9.1
 
How to ask for money
How to ask for moneyHow to ask for money
How to ask for money
 
Letters from the open source trenches - Postgres community
Letters from the open source trenches - Postgres communityLetters from the open source trenches - Postgres community
Letters from the open source trenches - Postgres community
 
Own it: working with a changing open source community
Own it: working with a changing open source communityOwn it: working with a changing open source community
Own it: working with a changing open source community
 
Managing terabytes: When Postgres gets big
Managing terabytes: When Postgres gets bigManaging terabytes: When Postgres gets big
Managing terabytes: When Postgres gets big
 
Managing terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets bigManaging terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets big
 
Making Software Communities
Making Software CommunitiesMaking Software Communities
Making Software Communities
 
Illustrated buffer cache
Illustrated buffer cacheIllustrated buffer cache
Illustrated buffer cache
 
Bucardo
BucardoBucardo
Bucardo
 
How a bunch of normal people Used Technology To Repair a Rigged Election
How a bunch of normal people Used Technology To Repair a Rigged ElectionHow a bunch of normal people Used Technology To Repair a Rigged Election
How a bunch of normal people Used Technology To Repair a Rigged Election
 
Open Source Bridge Opening Day
Open Source Bridge Opening DayOpen Source Bridge Opening Day
Open Source Bridge Opening Day
 

Pdxpugday2010 pg90

  • 1. PostgreSQL 9.0 Selena Deckelmann selenamarie@gmail.com PDXPUG Day 2010 July 18, 2010
  • 2. Many thanks to: Mark Wong markwkm@gmail.com Gabrielle Roth gorthx@gmail.com
  • 3. Introductions __ __ / ~~~/ . o O ( PostgreSQL? ) ,----( oo ) / __ __/ /| ( |( ^ /___ / | |__| |__|-"
  • 4. PostgreSQL - Current version 8.4.4 - 9.0 is in Beta - Release in August? - Get it here: http://www.postgresql.org/ftp/source/9.0beta3/ http://www.postgresql.org/developer/beta
  • 5. Contents Full list of features: http://developer.postgresql.org/pgdocs/postgres/ release-9-0.html
  • 6. To boldly go... ___________________ _-_ __(==========/_=_/ ____.---’---‘---.____ _ ----._________.----/ / / ‘-_-’ __,--‘.‘-’..’-_ /____ || ‘--.____,-’ Based on overwhelming user demand, this release of PostgreSQL adds features that have been requested for years, like easy-to-use replication, a mass permission facility, and anonymous code blocks.
  • 7. Seriously. It’s a big release - New feature patches: 204 - Submitters: 84 - 2189 files changed, 214227 insertions(+), 125369 deletions(-)
  • 8. Add the ability to make mass permission changes per schema using the new GRANT/REVOKE IN SCHEMA clause (Petr Jelinek) postgres# GRANT SELECT,INSERT,UPDATE ON ALL TABLES IN SCHEMA conference TO selena;
  • 9. Add ALTER DEFAULT PRIVILEGES command to control privileges of newly-created objects (Petr Jelinek) postgres# ALTER DEFAULT PRIVILEGES IN SCHEMA conference GRANT INSERT ON TABLES TO selena; Use psql’s ddp command to get info about existing assignments of default privileges.
  • 10. Install server-side language PL/pgSQL by default (Bruce Momjian) Yes. Also recall: CREATE [ OR REPLACE ] [ PROCEDURAL ] LANGUAGE name
  • 11. Implement anonymous functions using the DO statement, a.k.a anonymous blocks (Petr Jelinek, Joshua Tolley, Hannu Valtonen) DO $$ BEGIN FOR x IN 1..10 LOOP RAISE NOTICE ’Now at %’, x; END LOOP; END;$$;
  • 12. More DO... DO $$ for i in range(10): plpy.notice(i) $$ language ’plpythonu’;
  • 13. MOAR DO... DO $$ HAI I HAS A VAR ITZ 0 IM IN YR LOOP VAR R SUM OF VAR AN 1 VISIBLE VAR BOTH SAEM VAR AN 10, O RLY? YA RLY, GTFO OIC IM OUTTA YR LOOP KTHXBYE $$ language ’pllolcode’;
  • 14. Allow function calls to supply parameter names and match them to named parameters in the function definition (Pavel Stehule) (Demo.)
  • 15. Add support for to char() scientific notation output (’EEEE’) (Pavel Stehule, Brendan Jurd) postgres=# create table exponents_demo (example numeric); CREATE TABLE postgres=# INSERT INTO exponents_demo VALUES (’10000000’), (’2.54’), (’3.1415’), (’666’), (’6.02e+23’), (’5.29e-11’), (’8675309’) ;
  • 16. Con’t postgres=# SELECT * from exponents_demo ; example -------------------------- 10000000 2.54 3.1415 666 602000000000000000000000 0.0000000000529 8675309 (7 rows)
  • 17. Con’t postgres=# SELECT to_char(example, ’9.9EEEE’) AS lookyhere FROM exponents_demo ; lookyhere ----------- 1.0e+07 2.5e+00 3.1e+00 6.7e+02 6.0e+23 5.3e-11 8.7e+06 (7 rows)
  • 18. RADIUS Authentication (Magnus Hagander) #host database user CIDR-address auth-method [auth-opt host all all 0.0.0.0/0 radius radiusserver=1.2.3.4 radiussecret=canttouchthis radiusport=1234 radiusidentifier=gabscooldatabase
  • 19. Add samehost and samenet designations to pg hba.conf (Stef Walter) # IPv4 local connections: host all all 127.0.0.1/32 md5 host all all samehost md5 host all all samenet md5
  • 20. Log changed parameter values when postgresql.conf is reloaded (Peter Eisentraut) LOG: parameter "log_rotation_age" changed to "7d" LOG: parameter "port" cannot be changed without restarting LOG: parameter "log_rotation_age" changed to "1d" LOG: parameter "log_min_messages" changed to "notice" LOG: parameter "autovacuum" changed to "off" <2010-04-22 14:00:50 PDT >LOG: parameter "log_line_prefix <2010-04-22 14:00:50 PDT >LOG: parameter "log_statement"
  • 21. Add an SQL state option (%e) to log line prefix (Guillaume Smet) e.g.: log_line_prefix = ’<%t %d %u %e>’ gives you something like: <2010-04-22 21:02:02 PDT postgres postgres 00000> LOG: statement: ALTER TABLE drop_column_demo DROP COLUMN <2010-04-22 21:02:54 PDT postgres postgres 00000> LOG: statement: GRANT SELECT on drop_column_demo to groth <2010-04-22 21:02:54 PDT postgres postgres 42704> ERROR: role "groth" does not exist
  • 22. Add new EXPLAIN (BUFFERS) to report query buffer activity (Itagaki Takahiro) # EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM pg_attribute; QUERY PLA ----------------------------------------------------------- Seq Scan on pg_attribute (cost=0.00..52.35 rows=1935 widt (actual time=0.010..0.948 rows=1935 loops=1) Buffers: shared hit=16 read=17 Total runtime: 1.841 ms (3 rows) selena@postgres:5432=# EXPLAIN (ANALYZE, BUFFERS) SELECT * ----------------------------------------------------------- Seq Scan on pg_attribute (cost=0.00..52.35 rows=1935 widt (actual time=0.010..0.589 rows=1935 loops=1) Buffers: shared hit=33 Total runtime: 0.992 ms
  • 23. Allow EXPLAIN output in XML, JSON, and YAML formats (Robert Haas, Greg Sabino Mullane) EXPLAIN SELECT * FROM user_history ORDER BY "timestamp"; QUERY PLAN ----------------------------------------------------------- Sort (cost=18494.32..18852.33 rows=143204 width=34) Sort Key: "timestamp" -> Seq Scan on user_history (cost=0.00..2559.04 rows=1 (3 rows)
  • 24. Con’t EXPLAIN (FORMAT XML) SELECT * FROM user_history ORDER BY "timestamp"; QUERY PLAN ----------------------------------------------------------- <explain xmlns="http://www.postgresql.org/2009/explain"> + <Query> + <Plan> + <Node-Type>Sort</Node-Type> + <Startup-Cost>18494.32</Startup-Cost> + <Total-Cost>18852.33</Total-Cost> + <Plan-Rows>143204</Plan-Rows> + <Plan-Width>34</Plan-Width> + <Sort-Key> + <Item>"timestamp"</Item> + </Sort-Key> + ...
  • 25. Con’t ... <Plans> + <Plan> + <Node-Type>Seq Scan</Node-Type> + <Parent-Relationship>Outer</Parent-Relationship>+ <Relation-Name>user_history</Relation-Name> + <Alias>user_history</Alias> + <Startup-Cost>0.00</Startup-Cost> + <Total-Cost>2559.04</Total-Cost> + <Plan-Rows>143204</Plan-Rows> + <Plan-Width>34</Plan-Width> + </Plan> + </Plans> + </Plan> + </Query> + </explain> (1 row)
  • 26. Con’t EXPLAIN (FORMAT YAML) SELECT * FROM user_history ORDER BY "timestamp"; QUERY PLAN ------------------------------------- - Plan: + Node Type: Sort + Startup Cost: 18494.32 + Total Cost: 18852.33 + Plan Rows: 143204 + Plan Width: 34 + Sort Key: + - ""timestamp"" + ...
  • 27. Con’t Plans: + - Node Type: Seq Scan + Parent Relationship: Outer + Relation Name: user_history+ Alias: user_history + Startup Cost: 0.00 + Total Cost: 2559.04 + Plan Rows: 143204 + Plan Width: 34 (1 row)
  • 28. Add WHEN clause to CREATE TRIGGER to allow control over whether a trigger is fired (Takahiro Itagaki) CREATE TRIGGER name { BEFORE | AFTER } { event [ OR ... ] } ON table [ FOR [ EACH ] { ROW | STATEMENT } ] [ WHEN ( condition ) ] EXECUTE PROCEDURE function_name ( arguments )
  • 29. Allow NOTIFY to pass an optional string to listeners (Joachim Wieland) lfnw-9.0=# LISTEN l9_0; LISTEN lfnw-9.0=# NOTIFY l9_0, ’need coffee...’; NOTIFY Asynchronous notification "l9_0" with payload "need coffee..." received from server process with PID 10480. Also, now in-memory (faster!)
  • 30. Have columns defined with storage type MAIN remain on the main heap page unless it cannot fit (Kevin Grittner) 8k page size Before: a tuple might get TOAST’d prematurely LIVE DEMO!
  • 31. Add pg stat reset single table counters() and pg stat reset single function counters() to allow the resetting of statistics counters for individual tables and indexes (Magnus Hagander) (Discuss.)
  • 32. Add pg last xlog receive location() and pg last xlog replay location(), which can be used to monitor standby server WAL activity (Simon, Fujii Masao, Heikki) (Discuss.)
  • 33. Hot Standby/Streaming Replication . . . drumroll . . .
  • 34. And now for something completely different... Pg Android App Contest! http://wiki.postgresql.org/wiki/AndroidAppContest
  • 35. Odds & Ends VACUUM FULL is dead! Long live VACUUM FULL (like CLUSTER). Add deferrable unique constraints (Dean Rasheed) vacuumdb –analyze-only (Bruce Momjian) GRANT/REVOKE IN SCHEMA (Petr Jelinek) pg table size and pg indexes size (Bernd Helmle) Remove the use of flat files for system table bootstrapping (Tom, Alvaro) DROP COLUMN IF EXISTS (Andreas Freund) 64-bit Windows support (Tsutomu Yamada, Magnus Hagander) Improvements to PL/Perl (Tim Bunce) /contrib/passwordcheck (Laurenz Albe)
  • 36. Final Notes These slides: http://www.slideshare.net/selenamarie Try it! http://www.postgresql.org/ftp/source/9.0beta3/ http://www.postgresql.org/developer/beta http://wiki.postgresql.org/wiki/HowToBetaTest
  • 37. Acknowledgements Gabrielle Roth Mark Wong Magnus Hagander Hayley Jane Wakenshaw __ __ / ~~~/ . o O ( Thank you! ) ,----( oo ) / __ __/ /| ( |( ^ /___ / | |__| |__|-"
  • 38. License This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, (a) visit http://creativecommons.org/licenses/by/3.0/us/; or, (b) send a letter to Creative Commons, 171 2nd Street, Suite 300, San Francisco, California, 94105, USA.