SlideShare una empresa de Scribd logo
1 de 43
Descargar para leer sin conexión
Harder         Better

                          Faster         Stronger

                       PostgreSQL 9.1
                               Selena Deckelmann
                      PostgreSQL Global Development Group
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
11
        20
    N
   O
 SC
O
Say “Postgres.”
                                    c   e
                                  11
                                 en
                               20
                              fer
                         O on
                           N
                       eCC
                   O mS
                  So
c   e
                11
               en
             20
            fer
       O on
         N
     eCC
 O mS
So
“World’s most advanced open source database.”
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
c   e
                11
               en
             20
            fer
       O on
         N
     eCC
 O mS
So
c   e
                11
               en
             20
            fer
       O on
         N
     eCC
 O mS
So
c   e
                11
               en
             20
            fer
       O on
         N
     eCC
 O mS
So
Postgres disrupts the
                      commercial relational
                        database industry.
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Disruptive forces

                      Licensing

                      “Enterprise” Web development

                      Proprietary DBA Career Path
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Licensing

                      Drop-in replacement for custom application
                      development.

                      Cheap Data Warehousing

                      Ecosystem!
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
“Enterprise”
                        Web development
                      Postgres is a “Developers database” -
                      Extension is encouraged!

                      Database of choice for Django

                      Oracle wants PHP developers
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
“Visit the Ruby and Python Topic
                        for more information pertaining
                         to Ruby/RoR, Python and other
                      non-PHP scripting languages.”
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
DBA Career path
                      Companies can’t hire Postgres DBAs fast
                      enough.

                      Postgres is close enough to Oracle, that
                      Oracle DBAs can jump in.

                      What we do better: Data loading,
                      automation, TUI and GUI admin tools
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
And... Stability

                      Support major releases for at least 5 years.

                      Commits to HEAD are stable.

                      Bugs reported are fixed in <48 hrs.
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
10
 features

                      Harder             Better
        More secure & robust:     We made us better:
        SE Postgres               Writeable CTE
        Replication Tools         Per-column collations
                                  Extensions

                      Faster           Stronger
            Performance:       First in class:
            KNN Indexes        Serializable Snapshot Isolation
            Unlogged Tables    Foreign Data Wrappers
So
 O mS
     e




                               Synchronous Replication
      CC
       O on
         N
            fer
             20
               en
                11
                e c
Harder
                           c   e
                         11
                        en
                      20
                     fer
                O on
                  N
              eCC
          O mS
         So
Harder                                  Replication
                                                    Tools
                      WAL-based replication:
                        File-based (default 16-MB files)
                        Streaming (per-WAL record) (9.0)
                        Asynchronous
                        Warm standby
                        Hot standby (9.0)
                        Synchronous (9.1)
                       new!



                        Cascading replication (just committed... 9.2)
                       new!




                      http://www.pgcon.org/2010/schedule/attachments/149_PGCon2010-Built-in-Replication.pdf
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Harder                             Replication
                                               Tools
                      pg_stat_replication view
                      shows all replicas and their statuses

                      pg_basebackup
                      single-command cloning over port 5432
                      http://www.postgresql.org/docs/9.1/static/app-pgbasebackup.html

                      promote to master
                      pg_ctl promote
                      formerly only could do this by creating a trigger file

                      new functions
                      pg_last_xact_replay_timestamp()
                      pg_xlog_replay_pause()
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Harder
                                      SE-Postgres

                      SE-Linux security label support!
                      Originally a NSA-funded Linux kernel extension

                      For tablespace, schema, table, column,
                      sequence, view and procedure object classes

                      Will have integrated support in pgAdmin!
                       http://rhaas.blogspot.com/2010/09/se-linux-for-postgresql-part-1.html
So
 O mS




                       http://rhaas.blogspot.com/2010/09/se-linux-for-postgresql-part-2.html
     eCC
       O on
         N
            fer
             20




                       http://wiki.postgresql.org/wiki/SEPostgreSQL_Documentation
               en
                11
                e c
Better
                                     Writeable CTE

                 But first - What’s a CTE?
                   Common Table Expressions
                  A temporary table or VIEW that exists for just a
                 single query.
                 http://developer.postgresql.org/pgdocs/postgres/queries-with.html#QUERIES-WITH-
                 MODIFYING
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Better
                           c   e
                         11
                        en
                      20
                     fer
                O on
                  N
              eCC
          O mS
         So
Better            Common Table
                          Expression Example
                 WITH RECURSIVE t1(a, b) AS (
                     VALUES(0,0)
                   UNION ALL
                     SELECT CASE CAST(b AS BOOLEAN)
                             WHEN b % 3 = 0 THEN b
                             WHEN b % 5 = 0 THEN b
                          END,
                          b+1                             Euler Project, question 1:
                      FROM t1                                If we list all the natural numbers
                      WHERE b < 1000                      below 10 that are multiples of 3 or
                 )                                        5, we get 3, 5, 6 and 9. The sum of
                 SELECT sum(a) FROM t1;                   these multiples is 23.
                                                             Find the sum of all the multiples
                                                          of 3 or 5 below 1000.
So
 O mS
     eCC
       O on
         N
            fer
             20




                                 http://wiki.postgresql.org/wiki/Euler_Project,_Question_1
               en
                11
                e c
Better
                                    Writeable CTE
      Makes maintaining partitions easier:

       WITH deleted_posts AS (
            DELETE FROM posts
            WHERE created < now()
                      - '6 months'::INTERVAL
            RETURNING *
       )
       SELECT user_id, count(*) FROM deleted_posts group BY 1;

                           http://www.depesz.com/index.php/2011/03/16/waiting-for-9-1-writable-cte/
So
 O mS
     eCC
       O




                           http://xzilla.net/blog/2011/Mar/Upserting-via-Writeable-CTE.html
         on
         N
            fer
             20
               en
                11
                e c
Better                          Per-column
                                           collation
                      Supports multiple languages in the same table, and have ORDER BY
                      sort by language order (assuming you’ve loaded the correct collation
                      library)
                      BEFORE:

                      $ select * from normal_polish order by some_text;
                       some_text
                      -----------
                       alfa
                       car
                       ćma
                       coś
                       lama
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Better                    Per-column
                                     collation
                      AFTER:

                      $ select * from normal_polish order by some_text;
                       some_text
                      -----------
                       alfa
                       car
                       coś
                       ćma
                       lama
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Better
                                           Extensions
                      Postgres-specific package management for
                      contrib/, PgFoundry projects, tools.

                      Like Oracle "packages"

                      End user view: http://facility9.com/2011/03/postgresql-extensions/

                      Docs: http://developer.postgresql.org/pgdocs/postgres/sql-
                      createextension.html
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Extensions
Better                         11
                              en
                                 c   e
                            20
                           fer
                      O on
                        N
                    eCC
                O mS
               So
Faster
                           c   e
                         11
                        en
                      20
                     fer
                O on
                  N
              eCC
          O mS
         So
Faster                 K-Nearest
                              Neighbor Indexes
                      Incredibly fast search for things that are
                      "near" a particular object

                      Operator is: <->
                      Datatypes supported: pg_trgm contrib and
                      btree_gist datatypes (point)
                      Wiki: http://wiki.postgresql.org/wiki/
                      What's_new_in_PostgreSQL_9.1#K-Nearest-Neighbor_Indexing
                      Developer: http://www.sai.msu.su/~megera/postgres/talks/
                      pgday-2010.pdf
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Faster                  K-Nearest
                               Neighbor Indexes
                      $ create table test ( position point );
                      $ insert into test (position) select point( random() * 1000, random() *
                      1000) from generate_series(1,1000000);

                      $ create index q on test using gist ( position );
                      $ select *, position <-> point(500,500) from test order by position <->
                      point(500,500) limit 10;

                      $ explain analyze select *, position <-> point(500,500) FROM test
                      ORDER BY position <-> point(500,500) limit 10;

                                                     QUERY PLAN
                       Limit (cost=0.00..0.77 rows=10 width=16) (actual time=0.164..0.475
                      rows=10 loops=1)
                         -> Index Scan using q on test (cost=0.00..76512.60 rows=1000000
                      width=16) (actual time=0.163..0.473 rows=10 loops=1)
So
 O




                               Order By: ("position" <-> '(500,500)'::point)
   mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Faster
                                    Unlogged Tables
                      Background: every write to a table in Postgres is essentially *two*
                      writes because of the Write Ahead Log (basis for replication, and
                      durability guarantees)

                      Unlogged tables are FREED of this durability constraint!

                      Could think of them as Global Temporary tables (see Haas' post)

                      http://www.depesz.com/index.php/2011/01/03/waiting-for-9-1-unlogged-tables/
                      http://rhaas.blogspot.com/2010/05/global-temporary-and-unlogged-tables.html

                      Example:
                      =$ perl -le 'my $x = "aaaaaaaa"; for (1..450000) {print $x++}' | 
                          perl -pe 's/.*/(047$&047)/;s/s*z/,/ if $.%3' | 
                          sed 's/.*/insert into test (some_text) values &;/'
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Stronger                Serializable
                               Snapshot Isolation
                      PostgreSQL's is the first production implementation
                      Includes: per transaction support

                      Why use it?
                      * No more blocking on table locks!
                      * No more "select for update"
                      * Simplifies programming

                      Wiki: http://wiki.postgresql.org/wiki/SSI
                      Developer:
                      My notes from Kevin's version of the talk: http://www.chesnok.com/
                      daily/2011/03/24/raw-notes-from-kevin-grittners-talk-on-ssi/
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Stronger
                             c   e
                           11
                          en
                        20
                       fer
                  O on
                    N
                eCC
            O mS
           So
Stronger
           Stronger              Foreign Data
                                  Wrappers
                      * Remote datasource access
                      * Initially implemented TEXT, CSV data sources
                      * Twitter: http://pgxn.org/dist/twitter_fdw/
                      * Google Summer of Code student is working on other data
                      sources
                      * Underway currently: Oracle and MySQL sources

                      Awesome because:
                      * 6-function API for implementing
                      * Good for implementing imports, things which would otherwise
                      fail if you just
                        used COPY (imporoving COPY is a whole other rant...)
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Stronger
           Stronger               Foreign Data
                                   Wrappers
                      Not awesome because:
                      * Nothing other than sequential scans are possible for query plans
                      * Not that many data sources implemented yet

                      Expect tons of FDWs to be implemented once we get 9.1 to
                      production release
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Stronger                          Syncronous
                                            Replication
                      This is *the* most important use case for WAL-level replication.
                      User:
                      http://developer.postgresql.org/pgdocs/postgres/warm-
                      standby.html#SYNCHRONOUS-REPLICATION
                      (kind of terrible for a person trying to understand how it works)

                      Somewhat better:
                      http://wiki.postgresql.org/wiki/What
                      %27s_new_in_PostgreSQL_9.1#Synchronous_replication_and_other_replic
                      ation_features

                      Wiki: http://wiki.postgresql.org/wiki/Synchronous_replication
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Stronger                  Syncronous
                                    Replication
                      WAL stands for "write ahead log" and it is what
                      ensures durability for all write operations

                      * WAL-shipping 16-MB chunks of these records
                      was the pre-9.0 method for built-in replication
                      * 9.0 and later have Streaming rep - per WAL
                      record (per-commit) shipping of changes
                      * Logical changes to DB, NOT statement-based
                      * All-or-nothing wrt databases and tables
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Stronger                   Syncronous
                                     Replication
                      * Create a replication role (no longer a forced role
                      creation like in 9.0)
                      * pg_hba.conf (host based authorization) update to
                      allow replication user to access system
                      * Five key configuration options: wal_level,
                      max_wal_senders, archive_mode, archive_command,
                      synchronous_standby_names
                      * Create a base backup that will be the slave
                      * recovery.conf config: restore_command,
                      standby_mode, primary_conninfo, trigger_file
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Terrifyingly live demo.
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Harder          Better

                              Faster          Stronger

                      Thanks to
                      Josh Berkus
                      http://www.pgexperts.com/document.html?id=50

                      Depesz
                      http://www.depesz.com
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Harder        Better

                             Faster        Stronger

                      Other Postgres talks:
                      Pro PostgreSQL
                      Robert Treat, 1:40pm Wednesday

                      Unbreaking your Django Application
                      Christophe Pettus, 9am
So
 O mS




                      (tutorial happening NOW)
     eCC
       O on
         N
            fer
             20
               en
                11
                e c
Harder     Better

                                Faster     Stronger


                      Selena Deckelmann
                      @selenamarie
                      http://chesnok.com

                      For hire! :)
So
 O mS
     eCC
       O on
         N
            fer
             20
               en
                11
                e c

Más contenido relacionado

Destacado

Destacado (8)

Personal Inquiry
Personal  InquiryPersonal  Inquiry
Personal Inquiry
 
Un lindo mensaje
Un lindo mensajeUn lindo mensaje
Un lindo mensaje
 
Ivan Derganskyi
Ivan DerganskyiIvan Derganskyi
Ivan Derganskyi
 
YOCard v4.2
YOCard v4.2YOCard v4.2
YOCard v4.2
 
Git is my hero
Git is my heroGit is my hero
Git is my hero
 
みんなでコーヒーミーティング 20120418
みんなでコーヒーミーティング 20120418みんなでコーヒーミーティング 20120418
みんなでコーヒーミーティング 20120418
 
Measuring Social Media For B2B
Measuring Social Media For B2BMeasuring Social Media For B2B
Measuring Social Media For B2B
 
Korea
KoreaKorea
Korea
 

Similar a Harder, better, faster, stronger: PostgreSQL 9.1

Why Architecture in Web Development matters
Why Architecture in Web Development mattersWhy Architecture in Web Development matters
Why Architecture in Web Development mattersLars Jankowfsky
 
Froscon2011: How i learned to use sql and then learned not to use it
Froscon2011:  How i learned to use sql and then learned not to use itFroscon2011:  How i learned to use sql and then learned not to use it
Froscon2011: How i learned to use sql and then learned not to use itHenrik Ingo
 
What the hell is wrong with EOS?
What the hell is wrong with EOS?What the hell is wrong with EOS?
What the hell is wrong with EOS?Dawson Hun
 
SQL? NoSQL? NewSQL?!? What's a Java developer to do? - PhillyETE 2012
SQL? NoSQL? NewSQL?!? What's a Java developer to do? - PhillyETE 2012SQL? NoSQL? NewSQL?!? What's a Java developer to do? - PhillyETE 2012
SQL? NoSQL? NewSQL?!? What's a Java developer to do? - PhillyETE 2012Chris Richardson
 
LF_OVS_17_Red Hat's perspective on OVS HW Offload Status
LF_OVS_17_Red Hat's perspective on OVS HW Offload StatusLF_OVS_17_Red Hat's perspective on OVS HW Offload Status
LF_OVS_17_Red Hat's perspective on OVS HW Offload StatusLF_OpenvSwitch
 
Plone TuneUp challenges
Plone TuneUp challengesPlone TuneUp challenges
Plone TuneUp challengesAndrew Mleczko
 
Java Performance
Java PerformanceJava Performance
Java PerformanceSSA KPI
 

Similar a Harder, better, faster, stronger: PostgreSQL 9.1 (11)

Pg92 HA, LCA 2012, Ballarat
Pg92 HA, LCA 2012, BallaratPg92 HA, LCA 2012, Ballarat
Pg92 HA, LCA 2012, Ballarat
 
Why Architecture in Web Development matters
Why Architecture in Web Development mattersWhy Architecture in Web Development matters
Why Architecture in Web Development matters
 
Day @ cio-gipfel 2007
Day @ cio-gipfel 2007Day @ cio-gipfel 2007
Day @ cio-gipfel 2007
 
New em12c kscope
New em12c kscopeNew em12c kscope
New em12c kscope
 
Froscon2011: How i learned to use sql and then learned not to use it
Froscon2011:  How i learned to use sql and then learned not to use itFroscon2011:  How i learned to use sql and then learned not to use it
Froscon2011: How i learned to use sql and then learned not to use it
 
What the hell is wrong with EOS?
What the hell is wrong with EOS?What the hell is wrong with EOS?
What the hell is wrong with EOS?
 
SQL? NoSQL? NewSQL?!? What's a Java developer to do? - PhillyETE 2012
SQL? NoSQL? NewSQL?!? What's a Java developer to do? - PhillyETE 2012SQL? NoSQL? NewSQL?!? What's a Java developer to do? - PhillyETE 2012
SQL? NoSQL? NewSQL?!? What's a Java developer to do? - PhillyETE 2012
 
LF_OVS_17_Red Hat's perspective on OVS HW Offload Status
LF_OVS_17_Red Hat's perspective on OVS HW Offload StatusLF_OVS_17_Red Hat's perspective on OVS HW Offload Status
LF_OVS_17_Red Hat's perspective on OVS HW Offload Status
 
Arrays in database systems, the next frontier?
Arrays in database systems, the next frontier?Arrays in database systems, the next frontier?
Arrays in database systems, the next frontier?
 
Plone TuneUp challenges
Plone TuneUp challengesPlone TuneUp challenges
Plone TuneUp challenges
 
Java Performance
Java PerformanceJava Performance
Java Performance
 

Más 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
 
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
 
What Assumptions Make: Filesystem I/O from a database perspective
What Assumptions Make: Filesystem I/O from a database perspectiveWhat Assumptions Make: Filesystem I/O from a database perspective
What Assumptions Make: Filesystem I/O from a database perspectiveSelena Deckelmann
 

Más 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
 
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
 
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
 
Pdxpugday2010 pg90
Pdxpugday2010 pg90Pdxpugday2010 pg90
Pdxpugday2010 pg90
 
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
 
What Assumptions Make: Filesystem I/O from a database perspective
What Assumptions Make: Filesystem I/O from a database perspectiveWhat Assumptions Make: Filesystem I/O from a database perspective
What Assumptions Make: Filesystem I/O from a database perspective
 

Último

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
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
 
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
 
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
 
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
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Último (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
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
 
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
 
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
 
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
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 

Harder, better, faster, stronger: PostgreSQL 9.1

  • 1. Harder Better Faster Stronger PostgreSQL 9.1 Selena Deckelmann PostgreSQL Global Development Group So O mS eCC O on N fer 20 en 11 e c
  • 2. 11 20 N O SC O
  • 3. Say “Postgres.” c e 11 en 20 fer O on N eCC O mS So
  • 4. c e 11 en 20 fer O on N eCC O mS So
  • 5. “World’s most advanced open source database.” So O mS eCC O on N fer 20 en 11 e c
  • 6. c e 11 en 20 fer O on N eCC O mS So
  • 7. c e 11 en 20 fer O on N eCC O mS So
  • 8. c e 11 en 20 fer O on N eCC O mS So
  • 9. Postgres disrupts the commercial relational database industry. So O mS eCC O on N fer 20 en 11 e c
  • 10. Disruptive forces Licensing “Enterprise” Web development Proprietary DBA Career Path So O mS eCC O on N fer 20 en 11 e c
  • 11. Licensing Drop-in replacement for custom application development. Cheap Data Warehousing Ecosystem! So O mS eCC O on N fer 20 en 11 e c
  • 12. “Enterprise” Web development Postgres is a “Developers database” - Extension is encouraged! Database of choice for Django Oracle wants PHP developers So O mS eCC O on N fer 20 en 11 e c
  • 13. “Visit the Ruby and Python Topic for more information pertaining to Ruby/RoR, Python and other non-PHP scripting languages.” So O mS eCC O on N fer 20 en 11 e c
  • 14. DBA Career path Companies can’t hire Postgres DBAs fast enough. Postgres is close enough to Oracle, that Oracle DBAs can jump in. What we do better: Data loading, automation, TUI and GUI admin tools So O mS eCC O on N fer 20 en 11 e c
  • 15. And... Stability Support major releases for at least 5 years. Commits to HEAD are stable. Bugs reported are fixed in <48 hrs. So O mS eCC O on N fer 20 en 11 e c
  • 16. 10 features Harder Better More secure & robust: We made us better: SE Postgres Writeable CTE Replication Tools Per-column collations Extensions Faster Stronger Performance: First in class: KNN Indexes Serializable Snapshot Isolation Unlogged Tables Foreign Data Wrappers So O mS e Synchronous Replication CC O on N fer 20 en 11 e c
  • 17. Harder c e 11 en 20 fer O on N eCC O mS So
  • 18. Harder Replication Tools WAL-based replication: File-based (default 16-MB files) Streaming (per-WAL record) (9.0) Asynchronous Warm standby Hot standby (9.0) Synchronous (9.1) new! Cascading replication (just committed... 9.2) new! http://www.pgcon.org/2010/schedule/attachments/149_PGCon2010-Built-in-Replication.pdf So O mS eCC O on N fer 20 en 11 e c
  • 19. Harder Replication Tools pg_stat_replication view shows all replicas and their statuses pg_basebackup single-command cloning over port 5432 http://www.postgresql.org/docs/9.1/static/app-pgbasebackup.html promote to master pg_ctl promote formerly only could do this by creating a trigger file new functions pg_last_xact_replay_timestamp() pg_xlog_replay_pause() So O mS eCC O on N fer 20 en 11 e c
  • 20. Harder SE-Postgres SE-Linux security label support! Originally a NSA-funded Linux kernel extension For tablespace, schema, table, column, sequence, view and procedure object classes Will have integrated support in pgAdmin! http://rhaas.blogspot.com/2010/09/se-linux-for-postgresql-part-1.html So O mS http://rhaas.blogspot.com/2010/09/se-linux-for-postgresql-part-2.html eCC O on N fer 20 http://wiki.postgresql.org/wiki/SEPostgreSQL_Documentation en 11 e c
  • 21. Better Writeable CTE But first - What’s a CTE? Common Table Expressions A temporary table or VIEW that exists for just a single query. http://developer.postgresql.org/pgdocs/postgres/queries-with.html#QUERIES-WITH- MODIFYING So O mS eCC O on N fer 20 en 11 e c
  • 22. Better c e 11 en 20 fer O on N eCC O mS So
  • 23. Better Common Table Expression Example WITH RECURSIVE t1(a, b) AS ( VALUES(0,0) UNION ALL SELECT CASE CAST(b AS BOOLEAN) WHEN b % 3 = 0 THEN b WHEN b % 5 = 0 THEN b END, b+1 Euler Project, question 1: FROM t1 If we list all the natural numbers WHERE b < 1000 below 10 that are multiples of 3 or ) 5, we get 3, 5, 6 and 9. The sum of SELECT sum(a) FROM t1; these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. So O mS eCC O on N fer 20 http://wiki.postgresql.org/wiki/Euler_Project,_Question_1 en 11 e c
  • 24. Better Writeable CTE Makes maintaining partitions easier: WITH deleted_posts AS ( DELETE FROM posts WHERE created < now() - '6 months'::INTERVAL RETURNING * ) SELECT user_id, count(*) FROM deleted_posts group BY 1; http://www.depesz.com/index.php/2011/03/16/waiting-for-9-1-writable-cte/ So O mS eCC O http://xzilla.net/blog/2011/Mar/Upserting-via-Writeable-CTE.html on N fer 20 en 11 e c
  • 25. Better Per-column collation Supports multiple languages in the same table, and have ORDER BY sort by language order (assuming you’ve loaded the correct collation library) BEFORE: $ select * from normal_polish order by some_text; some_text ----------- alfa car ćma coś lama So O mS eCC O on N fer 20 en 11 e c
  • 26. Better Per-column collation AFTER: $ select * from normal_polish order by some_text; some_text ----------- alfa car coś ćma lama So O mS eCC O on N fer 20 en 11 e c
  • 27. Better Extensions Postgres-specific package management for contrib/, PgFoundry projects, tools. Like Oracle "packages" End user view: http://facility9.com/2011/03/postgresql-extensions/ Docs: http://developer.postgresql.org/pgdocs/postgres/sql- createextension.html So O mS eCC O on N fer 20 en 11 e c
  • 28. Extensions Better 11 en c e 20 fer O on N eCC O mS So
  • 29. Faster c e 11 en 20 fer O on N eCC O mS So
  • 30. Faster K-Nearest Neighbor Indexes Incredibly fast search for things that are "near" a particular object Operator is: <-> Datatypes supported: pg_trgm contrib and btree_gist datatypes (point) Wiki: http://wiki.postgresql.org/wiki/ What's_new_in_PostgreSQL_9.1#K-Nearest-Neighbor_Indexing Developer: http://www.sai.msu.su/~megera/postgres/talks/ pgday-2010.pdf So O mS eCC O on N fer 20 en 11 e c
  • 31. Faster K-Nearest Neighbor Indexes $ create table test ( position point ); $ insert into test (position) select point( random() * 1000, random() * 1000) from generate_series(1,1000000); $ create index q on test using gist ( position ); $ select *, position <-> point(500,500) from test order by position <-> point(500,500) limit 10; $ explain analyze select *, position <-> point(500,500) FROM test ORDER BY position <-> point(500,500) limit 10; QUERY PLAN Limit (cost=0.00..0.77 rows=10 width=16) (actual time=0.164..0.475 rows=10 loops=1) -> Index Scan using q on test (cost=0.00..76512.60 rows=1000000 width=16) (actual time=0.163..0.473 rows=10 loops=1) So O Order By: ("position" <-> '(500,500)'::point) mS eCC O on N fer 20 en 11 e c
  • 32. Faster Unlogged Tables Background: every write to a table in Postgres is essentially *two* writes because of the Write Ahead Log (basis for replication, and durability guarantees) Unlogged tables are FREED of this durability constraint! Could think of them as Global Temporary tables (see Haas' post) http://www.depesz.com/index.php/2011/01/03/waiting-for-9-1-unlogged-tables/ http://rhaas.blogspot.com/2010/05/global-temporary-and-unlogged-tables.html Example: =$ perl -le 'my $x = "aaaaaaaa"; for (1..450000) {print $x++}' | perl -pe 's/.*/(047$&047)/;s/s*z/,/ if $.%3' | sed 's/.*/insert into test (some_text) values &;/' So O mS eCC O on N fer 20 en 11 e c
  • 33. Stronger Serializable Snapshot Isolation PostgreSQL's is the first production implementation Includes: per transaction support Why use it? * No more blocking on table locks! * No more "select for update" * Simplifies programming Wiki: http://wiki.postgresql.org/wiki/SSI Developer: My notes from Kevin's version of the talk: http://www.chesnok.com/ daily/2011/03/24/raw-notes-from-kevin-grittners-talk-on-ssi/ So O mS eCC O on N fer 20 en 11 e c
  • 34. Stronger c e 11 en 20 fer O on N eCC O mS So
  • 35. Stronger Stronger Foreign Data Wrappers * Remote datasource access * Initially implemented TEXT, CSV data sources * Twitter: http://pgxn.org/dist/twitter_fdw/ * Google Summer of Code student is working on other data sources * Underway currently: Oracle and MySQL sources Awesome because: * 6-function API for implementing * Good for implementing imports, things which would otherwise fail if you just used COPY (imporoving COPY is a whole other rant...) So O mS eCC O on N fer 20 en 11 e c
  • 36. Stronger Stronger Foreign Data Wrappers Not awesome because: * Nothing other than sequential scans are possible for query plans * Not that many data sources implemented yet Expect tons of FDWs to be implemented once we get 9.1 to production release So O mS eCC O on N fer 20 en 11 e c
  • 37. Stronger Syncronous Replication This is *the* most important use case for WAL-level replication. User: http://developer.postgresql.org/pgdocs/postgres/warm- standby.html#SYNCHRONOUS-REPLICATION (kind of terrible for a person trying to understand how it works) Somewhat better: http://wiki.postgresql.org/wiki/What %27s_new_in_PostgreSQL_9.1#Synchronous_replication_and_other_replic ation_features Wiki: http://wiki.postgresql.org/wiki/Synchronous_replication So O mS eCC O on N fer 20 en 11 e c
  • 38. Stronger Syncronous Replication WAL stands for "write ahead log" and it is what ensures durability for all write operations * WAL-shipping 16-MB chunks of these records was the pre-9.0 method for built-in replication * 9.0 and later have Streaming rep - per WAL record (per-commit) shipping of changes * Logical changes to DB, NOT statement-based * All-or-nothing wrt databases and tables So O mS eCC O on N fer 20 en 11 e c
  • 39. Stronger Syncronous Replication * Create a replication role (no longer a forced role creation like in 9.0) * pg_hba.conf (host based authorization) update to allow replication user to access system * Five key configuration options: wal_level, max_wal_senders, archive_mode, archive_command, synchronous_standby_names * Create a base backup that will be the slave * recovery.conf config: restore_command, standby_mode, primary_conninfo, trigger_file So O mS eCC O on N fer 20 en 11 e c
  • 40. Terrifyingly live demo. So O mS eCC O on N fer 20 en 11 e c
  • 41. Harder Better Faster Stronger Thanks to Josh Berkus http://www.pgexperts.com/document.html?id=50 Depesz http://www.depesz.com So O mS eCC O on N fer 20 en 11 e c
  • 42. Harder Better Faster Stronger Other Postgres talks: Pro PostgreSQL Robert Treat, 1:40pm Wednesday Unbreaking your Django Application Christophe Pettus, 9am So O mS (tutorial happening NOW) eCC O on N fer 20 en 11 e c
  • 43. Harder Better Faster Stronger Selena Deckelmann @selenamarie http://chesnok.com For hire! :) So O mS eCC O on N fer 20 en 11 e c