SlideShare ist ein Scribd-Unternehmen logo
1 von 85
Downloaden Sie, um offline zu lesen
PostgreSQL 9.0 / Prolog




                   •      Want to play along?

                   •      PostgreSQL 9.0

                          •   git clone git://git.postgresql.org/git/postgresql.git

                          •   http://www.postgresql.org/docs/current/static/anoncvs.html

                          •   ./configure; make; make install;

                   •      Pagila Sample Database

                          •   http://pgfoundry.org/frs/?group_id=1000150&release_id=998




Wednesday, June 2, 2010
No More Waiting
                 A Guide to PostgreSQL 9.0



                            / Presentation / Robert Treat



Wednesday, June 2, 2010
Know More Waiting
                 A Guide to PostgreSQL 9.0



                            / Presentation / Robert Treat



Wednesday, June 2, 2010
Know More Waiting
                 A Guide to Postgres 9.0



                             / Presentation / Robert Treat



Wednesday, June 2, 2010
Postgres 9.0




                   •      Performance

                   •      Administration

                   •      Development

                   •      Procedures

                   •      Replication




Wednesday, June 2, 2010
Postgres 9.0




                          BUT FIRST!




Wednesday, June 2, 2010
Postgres 9.0 / Recap




Wednesday, June 2, 2010
Postgres 9.0 / Recap




                   •      8.4 Released (2009-07-01)




Wednesday, June 2, 2010
Postgres 9.0 / Recap




                   •      8.4 Released (2009-07-01)

                   •      Commit Fests (July,September,November,January)




Wednesday, June 2, 2010
Postgres 9.0 / Recap




                   •      8.4 Released (2009-07-01)

                   •      Commit Fests (July,September,November,January)

                   •      Alpha Release after each Commit Fest




Wednesday, June 2, 2010
Postgres 9.0 / Recap




                   •      8.4 Released (2009-07-01)

                   •      Commit Fests (July,September,November,January)

                   •      Alpha Release after each Commit Fest

                   •      Feature Freeze (February)




Wednesday, June 2, 2010
Postgres 9.0 / Recap




                   •      8.4 Released (2009-07-01)

                   •      Commit Fests (July,September,November,January)

                   •      Alpha Release after each Commit Fest

                   •      Feature Freeze (February)

                   •      9.0 ?!?




Wednesday, June 2, 2010
Postgres 9.0 / Recap




                   •      8.4 Released (2009-07-01)

                   •      Commit Fests (July,September,November,January)

                   •      Alpha Release after each Commit Fest

                   •      Feature Freeze (February)

                   •      9.0 ?!?

                   •      Beta (April 29)




Wednesday, June 2, 2010
Postgres 9.0 / Recap




                   •      8.4 Released (2009-07-01)

                   •      Commit Fests (July,September,November,January)

                   •      Alpha Release after each Commit Fest

                   •      Feature Freeze (February)

                   •      9.0 ?!?

                   •      Beta (April 29)

                   •      Release (May ? June ? July)




Wednesday, June 2, 2010
Postgres 9.0 / Stats




Wednesday, June 2, 2010
Postgres 9.0 / Stats




                   •      New feature patches: 204




Wednesday, June 2, 2010
Postgres 9.0 / Stats




                   •      New feature patches: 204

                          •   doesn’t include direct commits




Wednesday, June 2, 2010
Postgres 9.0 / Stats




                   •      New feature patches: 204

                          •   doesn’t include direct commits

                   •      Submitters: 84




Wednesday, June 2, 2010
Postgres 9.0 / Stats




                   •      New feature patches: 204

                          •   doesn’t include direct commits

                   •      Submitters: 84

                          •   doesn’t include committers




Wednesday, June 2, 2010
Postgres 9.0 / Stats




                   •      New feature patches: 204

                          •   doesn’t include direct commits

                   •      Submitters: 84

                          •   doesn’t include committers

                   •      1860 files changed




Wednesday, June 2, 2010
Postgres 9.0 / Stats




                   •      New feature patches: 204

                          •   doesn’t include direct commits

                   •      Submitters: 84

                          •   doesn’t include committers

                   •      1860 files changed

                          •   150951 insertions




Wednesday, June 2, 2010
Postgres 9.0 / Stats




                   •      New feature patches: 204

                          •   doesn’t include direct commits

                   •      Submitters: 84

                          •   doesn’t include committers

                   •      1860 files changed

                          •   150951 insertions

                          •   82558 deletions




Wednesday, June 2, 2010
Postgres 9.0




                   •      Performance

                   •      Administration

                   •      Development

                   •      Procedures

                   •      Replication




Wednesday, June 2, 2010
Postgres 9.0 / Perf / vacuum full




Wednesday, June 2, 2010
Postgres 9.0 / Perf / vacuum full


                   •      VACUUM FULL now works like CLUSTER

                          •   The Old

                              •   move rows around, heavy scans, bloat indexes

                              •   syntax available with VACUUM FULL INPLACE

                              •   still used for system catalogs




Wednesday, June 2, 2010
Postgres 9.0 / Perf / vacuum full


                   •      VACUUM FULL now works like CLUSTER

                          •   The Old

                              •   move rows around, heavy scans, bloat indexes

                              •   syntax available with VACUUM FULL INPLACE

                              •   still used for system catalogs

                          •   NEW

                              •   rewrite table and indexes

                              •   ~ 2% less efficient for tables, 90% more efficient for indexes

                              •   1/3 the amount of time

                              •   continue to avoid it :-)




Wednesday, June 2, 2010
Postgres 9.0 / Perf / vacuum full




Wednesday, June 2, 2010
Postgres 9.0 / Perf / explain buffers

                                      explain can now show buffers information



         pagila=# explain (analyze, buffers) select * from actor;
                                                QUERY PLAN
         ----------------------------------------------------------------------------------------------------
          Seq Scan on actor (cost=0.00..4.00 rows=200 width=25) (actual time=0.034..0.089 rows=200 loops=1)
            Buffers: shared read=2
         Total runtime: 0.149 ms
         (3 rows)

         pagila=# explain (analyze, buffers) select count(*) from actor;
                                                 QUERY PLAN
         ---------------------------------------------------------------------------------------------------------
          Aggregate (cost=4.50..4.51 rows=1 width=0) (actual time=0.109..0.109 rows=1 loops=1)
            Buffers: shared hit=2
            -> Seq Scan on actor (cost=0.00..4.00 rows=200 width=0) (actual time=0.010..0.048 rows=200 loops=1)
                 Buffers: shared hit=2
         Total runtime: 0.173 ms
         (5 rows)




Wednesday, June 2, 2010
Postgres 9.0 / Perf / index not null

                                   support index use for IS NOT NULL

           PostgreSQL 8.4

         pagila=# explain select * from address where address2 is not null;
                                QUERY PLAN
         ---------------------------------------------------------
          Seq Scan on address (cost=0.00..20.03 rows=1 width=70)
            Filter: (address2 IS NOT NULL)
         (2 rows)




             PostgreSQL 9.0 Beta 1

         pagila=# explain select * from address where address2 is not null;
                                               QUERY PLAN
         -------------------------------------------------------------------------------------
          Index Scan using address_address2_idx on address (cost=0.00..8.27 rows=1 width=70)
            Index Cond: (address2 IS NOT NULL)
         (2 rows)




Wednesday, June 2, 2010
Postgres 9.0 / Perf / join removal

                             remove joins from execution plan where not needed



         PostgreSQL 9.0 Alpha 4

         pagila=# explain analyze select actor.last_name from actor left join film_actor using (actor_id) where
         actor.last_update > current_date;
                                                       QUERY PLAN
         ------------------------------------------------------------------------------------------------------
          Nested Loop Left Join (cost=4.46..38.48 rows=27 width=35) (actual time=0.258..0.258 rows=0 loops=1)
            -> Seq Scan on actor (cost=0.00..5.50 rows=1 width=25) (actual time=0.257..0.257 rows=0 loops=1)
                  Filter: (last_update > ('now'::text)::date)
            -> Bitmap Heap Scan on film_actor (cost=4.46..32.64 rows=27 width=12) (never executed)
                  Recheck Cond: (actor.actor_id = film_actor.actor_id)
                  -> Bitmap Index Scan on film_actor_pkey (cost=0.00..4.45 rows=27 width=0) (never executed)
                        Index Cond: (actor.actor_id = film_actor.actor_id)
          Total runtime: 0.340 ms
         (8 rows)




                                               this is not join removal!



Wednesday, June 2, 2010
Postgres 9.0 / Perf / join removal
             PostgreSQL 8.4

           pagila=# explain analyze select city from city left join country using (country_id) where city.last_update
           > current_date;
                                                          QUERY PLAN
           --------------------------------------------------------------------------------------------------------
            Nested Loop Left Join (cost=0.00..17.95 rows=1 width=9) (actual time=28.022..28.022 rows=0 loops=1)
              Join Filter: (city.country_id = country.country_id)
              -> Seq Scan on city (cost=0.00..14.50 rows=1 width=11) (actual time=28.021..28.021 rows=0 loops=1)
                    Filter: (last_update > ('now'::text)::date)
              -> Seq Scan on country (cost=0.00..2.09 rows=109 width=4) (never executed)
            Total runtime: 30.567 ms
           (6 rows)




              PostgreSQL 9.0 Beta 1

           pagila=# explain analyze select city from city left join country using (country_id) where city.last_update
           > current_date;
                                                      QUERY PLAN
           ------------------------------------------------------------------------------------------------
            Seq Scan on city (cost=0.00..14.50 rows=1 width=11) (actual time=0.748..0.748 rows=0 loops=1)
              Filter: (last_update > ('now'::text)::date)
            Total runtime: 0.777 ms
           (3 rows)




Wednesday, June 2, 2010
Postgres 9.0 / Perf / tablespace costs




Wednesday, June 2, 2010
Postgres 9.0 / Perf / tablespace costs




                   •      Per Tablespace GUC Options

                          •   seq_page_cost

                          •   random_page_cost

                   •      ALTER TABLESPACE ... SET / RESET




Wednesday, June 2, 2010
Postgres 9.0 / Perf / tablespace costs




Wednesday, June 2, 2010
Postgres 9.0 / Perf / Wait, there’s more!




Wednesday, June 2, 2010
Postgres 9.0 / Perf / Wait, there’s more!




                   •      Increased GIN index creation for pre-ordered data

                   •      ALTER TABLE “rewrite” commands can skip xlogging

                   •      ALTER TABLE ... ALTER COLUMN ... SET DISTINCT

                   •      Optimize foo <> true => foo = false, foo <> false => foo = true

                   •      Improve pg_restore multi-workers logic for faster restores

                   •      Windows 64bit Support




Wednesday, June 2, 2010
Postgres 9.0 / Perf / Wait, there’s more!




Wednesday, June 2, 2010
Postgres 9.0




                   •      Performance

                   •      Administration

                   •      Development

                   •      Procedures

                   •      Replication




Wednesday, June 2, 2010
Postgres 9.0 / Admin / pg_ctl initdb


                                              initdb is dead (well, to me)




         sa-x:postgres rob$ pgsql90/bin/pg_ctl -D data/ initdb -o "--locale=en_US.UTF-8"
         The files belonging to this database system will be owned by user "rob".
         This user must also own the server process.

         The database cluster will be initialized with locale en_US.UTF-8.
         The default database encoding has accordingly been set to UTF8.
         The default text search configuration will be set to "english".
         ...




Wednesday, June 2, 2010
Postgres 9.0 / Admin / psql
                                              greatest feature in postgres 9?


         sa-x:postgres rob$ pgsql90b1/bin/psql -d pagila
         FATAL: unrecognized configuration parameter "application_name"
         psql (9.0beta1, server 8.3.5)
         WARNING: psql version 9.0, server version 8.3.
                Some psql features might not work.
         Type "help" for help.

         pagila=# d actor
                                           Table "public.actor"
            Column |               Type              |                   Modifiers
         -------------+-----------------------------+----------------------------------------------------------
          actor_id | integer                        | not null default nextval('actor_actor_id_seq'::regclass)
          first_name | character varying(45)               | not null
          last_name | character varying(45)               | not null
          last_update | timestamp without time zone | not null default now()
         Indexes:
            "actor_pkey" PRIMARY KEY, btree (actor_id)
            "idx_actor_last_name" btree (last_name)
         Referenced by:
            TABLE "film_actor" CONSTRAINT "film_actor_actor_id_fkey" FOREIGN KEY (actor_id) REFERENCES
         actor(actor_id) ON UPDATE CASCADE ON DELETE RESTRICT
         Triggers:
            last_updated BEFORE UPDATE ON actor FOR EACH ROW EXECUTE PROCEDURE last_updated()




Wednesday, June 2, 2010
Postgres 9.0 / Admin / grant all
                                 GRANT/REVOKE ON ALL object IN SCHEMA

         pagila=# create role dylan;
         CREATE ROLE
         pagila=# grant select on all tables in schema public to dylan;
         GRANT
         pagila=# select oid::regclass, relacl from pg_class where relkind='r' and relnamespace='2200';
                 oid       |                    relacl
         ------------------+----------------------------------------------
          film_actor       | {postgres=arwdDxt/postgres,dylan=r/postgres}
          payment_p2007_02 | {postgres=arwdDxt/postgres,dylan=r/postgres}
          payment_p2007_03 | {postgres=arwdDxt/postgres,dylan=r/postgres}
          city             | {postgres=arwdDxt/postgres,dylan=r/postgres}
          actor            | {postgres=arwdDxt/postgres,dylan=r/postgres}
          category         | {postgres=arwdDxt/postgres,dylan=r/postgres}
          film             | {postgres=arwdDxt/postgres,dylan=r/postgres}
          address          | {postgres=arwdDxt/postgres,dylan=r/postgres}
          store            | {postgres=arwdDxt/postgres,dylan=r/postgres}
          staff            | {postgres=arwdDxt/postgres,dylan=r/postgres}
          payment_p2007_04 | {postgres=arwdDxt/postgres,dylan=r/postgres}
          payment_p2007_05 | {postgres=arwdDxt/postgres,dylan=r/postgres}
          payment_p2007_06 | {postgres=arwdDxt/postgres,dylan=r/postgres}
          rental           | {postgres=arwdDxt/postgres,dylan=r/postgres}
          payment_p2007_01 | {postgres=arwdDxt/postgres,dylan=r/postgres}
          country          | {postgres=arwdDxt/postgres,dylan=r/postgres}
          payment          | {postgres=arwdDxt/postgres,dylan=r/postgres}
          film_category    | {postgres=arwdDxt/postgres,dylan=r/postgres}
          language         | {postgres=arwdDxt/postgres,dylan=r/postgres}
          customer         | {postgres=arwdDxt/postgres,dylan=r/postgres}
          inventory        | {postgres=arwdDxt/postgres,dylan=r/postgres}




Wednesday, June 2, 2010
Postgres 9.0 / Admin / default privs

                                  ALTER DEFAULT PRIVILEGES




         pagila=# alter default privileges grant select on tables to dylan;
         ALTER DEFAULT PRIVILEGES
         pagila=# create table payment_p2007_07 () inherits (payment);
         CREATE TABLE
         pagila=# z payment_p2007_07
                                             Access privileges
          Schema |       Name        | Type |     Access privileges      | Column access
         privileges
         --------+------------------+-------+---------------------------
         +--------------------------
          public | payment_p2007_07 | table | postgres=arwdDxt/postgres+|
                 |                   |      | dylan=r/postgres           |
         (1 row)




Wednesday, June 2, 2010
Postgres 9.0 / Admin / d for children



         pagila=# d payment
                                                   Table "public.payment"
             Column    |            Type             |                          Modifiers
         --------------+-----------------------------+-------------------------------------------------------------
          payment_id   | integer                     | not null default nextval('payment_payment_id_seq'::regclass)
          customer_id | smallint                     | not null
          staff_id     | smallint                    | not null
          rental_id    | integer                     | not null
          amount       | numeric(5,2)                | not null
          payment_date | timestamp without time zone | not null
         Indexes:
             "payment_pkey" PRIMARY KEY, btree (payment_id)
             "idx_fk_customer_id" btree (customer_id)
             "idx_fk_staff_id" btree (staff_id)
             "payment_rental_id_idx" btree (rental_id)
         Foreign-key constraints:
             "payment_customer_id_fkey" FOREIGN KEY (customer_id) REFERENCES customer(customer_id) ON UPDATE CASCADE ON DELETE RESTRICT
             "payment_rental_id_fkey" FOREIGN KEY (rental_id) REFERENCES rental(rental_id) ON UPDATE CASCADE ON DELETE SET NULL
             "payment_staff_id_fkey" FOREIGN KEY (staff_id) REFERENCES staff(staff_id) ON UPDATE CASCADE ON DELETE RESTRICT
         Rules:
          <snip>


         Number of child tables: 7 (Use d+ to list them.)




Wednesday, June 2, 2010
Postgres 9.0 / Admin / d for children
         pagila=# d+ payment
                                                                         Table "public.payment"
             Column    |            Type             |                                    Modifiers                                       | Storage |
         Description
         --------------+-----------------------------+-------------------------------------------------------------
          payment_id   | integer                     | not null default nextval('payment_payment_id_seq'::regclass)                       |   plain   |
          customer_id | smallint                     | not null                                                                           |   plain   |
          staff_id     | smallint                    | not null                                                                           |   plain   |
          rental_id    | integer                     | not null                                                                           |   plain   |
          amount       | numeric(5,2)                | not null                                                                           |   main    |
          payment_date | timestamp without time zone | not null                                                                           |   plain   |
         Indexes:
             "payment_pkey" PRIMARY KEY, btree (payment_id)
             "idx_fk_customer_id" btree (customer_id)
             "idx_fk_staff_id" btree (staff_id)
             "payment_rental_id_idx" btree (rental_id)
         Foreign-key constraints:
             "payment_customer_id_fkey" FOREIGN KEY (customer_id) REFERENCES customer(customer_id) ON UPDATE CASCADE ON DELETE RESTRICT
             "payment_rental_id_fkey" FOREIGN KEY (rental_id) REFERENCES rental(rental_id) ON UPDATE CASCADE ON DELETE SET NULL
             "payment_staff_id_fkey" FOREIGN KEY (staff_id) REFERENCES staff(staff_id) ON UPDATE CASCADE ON DELETE RESTRICT
         Rules:
              <snip>

           Child tables: payment_p2007_01,
                       payment_p2007_02,
                       payment_p2007_03,
                       payment_p2007_04,
                       payment_p2007_05,
                       payment_p2007_06,
                       payment_p2007_07
         Has OIDs: no




Wednesday, June 2, 2010
Postgres 9.0 / Admin / Wait, there’s more!




Wednesday, June 2, 2010
Postgres 9.0 / Admin / Wait, there’s more!


                   •      show value when unique
                                                           •   reindexing shared system
                          constraints are violated
                                                               catalogs is now crash safe
                   •      radius authentication
                                                           •   add ability to reset statistics
                                                               on individual tables
                   •      add SQLSTATE as option to
                          log_line_prefix
                                                           •   support samehost/samenet
                                                               options in pg_hba.conf
                   •      allow collection of statistics
                          on sequences
                                                           •   added string_agg function
                                                               (group_concat)
                   •      GUC can now be configured
                          based on user/database
                          combination                      •   improved tabular display for
                                                               psql rows with null data
                   •      log changes to postgresql.conf
                                                           •   add index methods to di
                          during reload




Wednesday, June 2, 2010
Postgres 9.0 / Admin / Wait, there’s more!




Wednesday, June 2, 2010
Postgres 9.0




                   •      Performance

                   •      Administration

                   •      Development

                   •      Procedures

                   •      Replication




Wednesday, June 2, 2010
Postgres 9.0 / Dev / conditional triggers


         CREATE TRIGGER notify_waiting_list

         AFTER UPDATE ON rental FOR EACH ROW

         WHEN NEW.return_date <> OLD.return_date

         THEN EXECUTE procedure send_notices();




                          •   improves control for execution of triggers

                          •   any boolean expression

                          •   shows up in d output

                          •   some after triggers will gain significant speed up




Wednesday, June 2, 2010
Postgres 9.0 / Dev / conditional triggers

         CREATE TRIGGER film_fulltext_trigger

         BEFORE INSERT OR UPDATE of title, description

         ON FILM FOR EACH ROW EXECUTE PROCEDURE

         tsvector_update_trigger('fulltext', 'pg_catalog.english', 'title', 'description')




                          •   improves control for execution of triggers

                          •   shows up in d output

                          •   simplify code

                          •   trigger only fires based on column declaration in update clause




Wednesday, June 2, 2010
Postgres 9.0 / Dev / exclusion constraints



            This is not the same thing as constraint exclusion!




                          “Yes, we suck at naming things”
                                          - Magnus Hagander




Wednesday, June 2, 2010
Postgres 9.0 / Dev / exclusion constraints




Wednesday, June 2, 2010
Postgres 9.0 / Dev / exclusion constraints



                   •      Generic constraint infrastructure

                   •      UNIQUE constraints are like =

                          •   any indexable commutative operator

                   •      BETWEEN-rows constraint

                          •   each row can conflict with any other row in
                              the table




Wednesday, June 2, 2010
Postgres 9.0 / Dev / exclusion constraints




Wednesday, June 2, 2010
Postgres 9.0 / Dev / exclusion constraints




Wednesday, June 2, 2010
Postgres 9.0 / Dev / exclusion constraints



                          •   Examples:

                              •   non-overlapping time intervals

                                  •   calendars, scheduling, reservations

                              •   non-overlapping geometric shapes

                                  •   zoning




Wednesday, June 2, 2010
Postgres 9.0 / Dev / exclusion constraints




Wednesday, June 2, 2010
Postgres 9.0 / Dev / exclusion constraints




                     Jeff Davis, “Not Just Unique”, Thu @ 1:30PM


Wednesday, June 2, 2010
Postgres 9.0 / Dev / exclusion constraints



                          •   Examples:

                              •   non-overlapping time intervals

                                  •   calendars, scheduling, reservations

                              •   non-overlapping geometric shapes

                                  •   zoning



                     Jeff Davis, “Not Just Unique”, Thu @ 1:30PM


Wednesday, June 2, 2010
Postgres 9.0 / Dev / exclusion constraints




                     Jeff Davis, “Not Just Unique”, Thu @ 1:30PM


Wednesday, June 2, 2010
Postgres 9.0 / Dev / window functions

         pagila=# pagila=#        select date_trunc('week',payment_date), sum(avg(sum(amount))

         pagila-#         over (order by date_trunc('week', payment_date) rows between 1 preceding and 1 following)

         pagila-# from payment_p2007_04 group by date_trunc('week',payment_date) order by 1;

                date_trunc          |       sum     |        avg

         ---------------------+---------+-----------------------

          2007-04-02 00:00:00 | 6562.62 | 7237.2300000000000000

          2007-04-09 00:00:00 | 7911.84 | 7611.8566666666666667

          2007-04-23 00:00:00 | 8361.11 | 7332.2800000000000000

          2007-04-30 00:00:00 | 5723.89 | 7042.5000000000000000

         (4 rows)




                                        •         enhancements to the frame clause

                                        •         now able to compute moving averages (easily)

                                        •         several options, check the docs!




Wednesday, June 2, 2010
Postgres 9.0 / Dev / Wait, there’s more!




Wednesday, June 2, 2010
Postgres 9.0 / Dev / Wait, there’s more!




                   •      deferrable unique constraints

                   •      new bytea hex format output

                   •      hstore... more efficient, kv    •   drop if exists columns
                          storage
                                                          •   drop if exists constraints
                   •      show value when unique
                                                          •   ordered aggregates
                          constraints are violated

                   •      added string_agg function       •   rewrite listen/notify
                                                              (payloads)
                          (group_concat)

                   •      support SQL Standard
                          LIMIT/OFFSET




Wednesday, June 2, 2010
Postgres 9.0 / Dev / Wait, there’s more!




Wednesday, June 2, 2010
Postgres 9.0




                   •      Performance

                   •      Administration

                   •      Development

                   •      Procedures

                   •      Replication




Wednesday, June 2, 2010
Postgres 9.0 / Proc / by default




                          plpgsql is now created by default




Wednesday, June 2, 2010
Postgres 9.0 / Proc / just DO it!


     pagila=#    DO $$
     pagila$#    DECLARE
     pagila$#      v_part record;
     pagila$#      v_sql text;
     pagila$#    BEGIN
     pagila$#      set search_path = 'public';
     pagila$#      for v_part in select tablename from pg_tables where tablename ~ 'payment' loop
     pagila$#        v_sql := 'create index '||v_part.tablename||'_rental_id_idx ON '||v_part.tablename||'(rental_id)';
     pagila$#        raise notice '%',v_sql;
     pagila$#        execute v_sql;
     pagila$#      end loop;
     pagila$#    END
     pagila$#    $$ language plpgsql;
     NOTICE:     create index payment_p2007_02_rental_id_idx ON payment_p2007_02(rental_id)
     NOTICE:     create index payment_p2007_03_rental_id_idx ON payment_p2007_03(rental_id)
     NOTICE:     create index payment_p2007_07_rental_id_idx ON payment_p2007_07(rental_id)
     NOTICE:     create index payment_p2007_04_rental_id_idx ON payment_p2007_04(rental_id)
     NOTICE:     create index payment_p2007_05_rental_id_idx ON payment_p2007_05(rental_id)
     NOTICE:     create index payment_p2007_06_rental_id_idx ON payment_p2007_06(rental_id)
     NOTICE:     create index payment_p2007_01_rental_id_idx ON payment_p2007_01(rental_id)
     NOTICE:     create index payment_rental_id_idx ON payment(rental_id)
     DO
     pagila=#




Wednesday, June 2, 2010
Postgres 9.0 / Proc / just DO it!



            pagila=# di payment_p2007_0*rental*
                                           List of relations
             Schema |              Name              | Type | Owner     |      Table
            --------+--------------------------------+-------+----------+------------------
             public | payment_p2007_01_rental_id_idx | index | postgres | payment_p2007_01
             public | payment_p2007_02_rental_id_idx | index | postgres | payment_p2007_02
             public | payment_p2007_03_rental_id_idx | index | postgres | payment_p2007_03
             public | payment_p2007_04_rental_id_idx | index | postgres | payment_p2007_04
             public | payment_p2007_05_rental_id_idx | index | postgres | payment_p2007_05
             public | payment_p2007_06_rental_id_idx | index | postgres | payment_p2007_06
             public | payment_p2007_07_rental_id_idx | index | postgres | payment_p2007_07
            (7 rows)




Wednesday, June 2, 2010
Postgres 9.0 / Proc / Wait, there’s more!




Wednesday, June 2, 2010
Postgres 9.0 / Proc / Wait, there’s more!


                   •      can now use expressions in
                          OPEN cursor FOR EXECUTE

                   •      improve variable recognition    •   use strict now works in plperl
                          within plpgsql
                                                          •   change Perl warnings to
                   •      allow assignment of values to       elog(WARNING)
                          IN parameters
                                                          •   Add Python 3 support
                   •      Allow MOVE FORWARD n/
                          ALL, MOVE BACKWARD n/           •   support for C++ stored procs
                          ALL for plpgsql cursors
                                                          •   named parameters
                   •      add utility functions for
                          plperl (quote_literal and
                          friends)




Wednesday, June 2, 2010
Postgres 9.0 / Proc / Wait, there’s more!




Wednesday, June 2, 2010
Postgres 9.0




                   •      Performance

                   •      Administration

                   •      Development

                   •      Procedures

                   •      Replication




Wednesday, June 2, 2010
Postgres 9.0 / repl / hot standby


                   •      allows for (read only) queries against a database during crash recovery

                          •   aka pitr replication / xlog shipping

                   •      GUC Settings

                          •   primary

                              •   wal_level = ‘hot standby’

                              •   vacuum_defer_cleanup_age = 0

                          •   secondary

                              •   hot_standby = on

                              •   max_standby_delay = 30s




Wednesday, June 2, 2010
Postgres 9.0 / repl / streaming replication

                   •      Process to connect to the primary from a secondary server and
                          “stream” changes to slaves

                   •      Config primary for archive logging, then

                          •   max_wal_senders

                   •      Config secondary for streaming replication

                          •   in recovery.conf

                              •   standby_mode = on

                              •   primary_conninfo = ...

                          •   in postgresql.conf

                              •   wal_level = archive

                              •   hot_standby = on




Wednesday, June 2, 2010
Postgres 9.0 / repl / Wait, there’s more!




Wednesday, June 2, 2010
Postgres 9.0 / repl / Wait, there’s more!




                   •      actually, there isn’t any more :-)




Wednesday, June 2, 2010
Postgres 9.0 / repl / Wait, there’s more!




Wednesday, June 2, 2010
Postgres 9.0 / repl / Wait, there’s more!




                  Heikki, “Built In-Replication”, Thu @ 10:00AM




Wednesday, June 2, 2010
Postgres 9.0




                   •      Performance

                   •      Administration

                   •      Procedures

                   •      Tools

                   •      Replication

                   •      Bonus Round!!




Wednesday, June 2, 2010
Postgres 9.0 / Upgrades




                   •      dump / restore recommend

                   •      “pg_upgrade” (the tool formerly known as pg_migrator)

                          •   8.3, 8.4 -> 9.0 (not dev releases)

                   •      replication

                          •   ?




Wednesday, June 2, 2010
Postgres 9.0 / Upgrades




                   •      Beware of incompatibilities

                          •   plpgsql variable conflicts

                          •   read the release notes!




Wednesday, June 2, 2010
Postgres 9.0 / Testing


                          •   Download

                              •   9.0 Beta 1 release

                              •   git, http://github.com/gregs1104/peg

                          •   Test

                              •   import existing schemas

                              •   import existing data

                              •   run application / code tests

                              •   test new features

                                  •   test pg_upgrade




Wednesday, June 2, 2010
Postgres 9.0 / More Info




                   •      http://www.depesz.com/

                   •      http://wiki.postgresql.org/

                   •      http://www.xzilla.net

                   •      PGCon, Ottawa, Canada, May 19th - 22nd (that’s now!)




Wednesday, June 2, 2010
Postgres 9.0 / Shout Out




                     •    Hubert Lubaczewski, aka “Depesz”

                     •    Magnus Hagander

                     •    Andreas Scherbaum

                     •    Chris Biggs

                     •    http://www.omniti.com/is/hiring




Wednesday, June 2, 2010
Thank you for listening.



                          / Presentation



Wednesday, June 2, 2010

Weitere ähnliche Inhalte

Ähnlich wie Intro to Postgres 9 Tutorial

Groovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume Laforge
Groovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume LaforgeGroovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume Laforge
Groovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume LaforgeGuillaume Laforge
 
"How Mozilla Uses Selenium"
"How Mozilla Uses Selenium""How Mozilla Uses Selenium"
"How Mozilla Uses Selenium"Stephen Donner
 
Eclipse Con 2010 PTP
Eclipse Con 2010 PTPEclipse Con 2010 PTP
Eclipse Con 2010 PTPgrwatson
 
AtlasCamp 2010: Implementing a custom JIRA UI using plugins 2.0 - Andreas Knecht
AtlasCamp 2010: Implementing a custom JIRA UI using plugins 2.0 - Andreas KnechtAtlasCamp 2010: Implementing a custom JIRA UI using plugins 2.0 - Andreas Knecht
AtlasCamp 2010: Implementing a custom JIRA UI using plugins 2.0 - Andreas KnechtAtlassian
 
Crowd-sourced Automated Firefox UI Testing
Crowd-sourced Automated Firefox UI TestingCrowd-sourced Automated Firefox UI Testing
Crowd-sourced Automated Firefox UI TestingHenrik Skupin
 
Feature Bits at LSSC10
Feature  Bits at LSSC10Feature  Bits at LSSC10
Feature Bits at LSSC10Erik Sowa
 
TYPO3 CMS 6.2 LTS Workshop T3DD13
TYPO3 CMS 6.2 LTS Workshop T3DD13TYPO3 CMS 6.2 LTS Workshop T3DD13
TYPO3 CMS 6.2 LTS Workshop T3DD13Ernesto Baschny
 
GemStone/S Update
GemStone/S UpdateGemStone/S Update
GemStone/S UpdateESUG
 
Sneak Peek of Nuxeo 5.4
Sneak Peek of Nuxeo 5.4Sneak Peek of Nuxeo 5.4
Sneak Peek of Nuxeo 5.4Nuxeo
 
The Art of Database Experiments – PostgresConf Silicon Valley 2018 / San Jose
The Art of Database Experiments – PostgresConf Silicon Valley 2018 / San JoseThe Art of Database Experiments – PostgresConf Silicon Valley 2018 / San Jose
The Art of Database Experiments – PostgresConf Silicon Valley 2018 / San JoseNikolay Samokhvalov
 
Graduating To Go - A Jumpstart into the Go Programming Language
Graduating To Go - A Jumpstart into the Go Programming LanguageGraduating To Go - A Jumpstart into the Go Programming Language
Graduating To Go - A Jumpstart into the Go Programming LanguageKaylyn Gibilterra
 
Batch Indexing & Near Real Time, keeping things fast
Batch Indexing & Near Real Time, keeping things fastBatch Indexing & Near Real Time, keeping things fast
Batch Indexing & Near Real Time, keeping things fastMarc Sturlese
 

Ähnlich wie Intro to Postgres 9 Tutorial (20)

Groovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume Laforge
Groovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume LaforgeGroovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume Laforge
Groovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume Laforge
 
Foss4 guk2016 aileenheal
Foss4 guk2016 aileenhealFoss4 guk2016 aileenheal
Foss4 guk2016 aileenheal
 
"How Mozilla Uses Selenium"
"How Mozilla Uses Selenium""How Mozilla Uses Selenium"
"How Mozilla Uses Selenium"
 
Eclipse Con 2010 PTP
Eclipse Con 2010 PTPEclipse Con 2010 PTP
Eclipse Con 2010 PTP
 
PostgreSQL 8.4 Update
PostgreSQL 8.4 UpdatePostgreSQL 8.4 Update
PostgreSQL 8.4 Update
 
AtlasCamp 2010: Implementing a custom JIRA UI using plugins 2.0 - Andreas Knecht
AtlasCamp 2010: Implementing a custom JIRA UI using plugins 2.0 - Andreas KnechtAtlasCamp 2010: Implementing a custom JIRA UI using plugins 2.0 - Andreas Knecht
AtlasCamp 2010: Implementing a custom JIRA UI using plugins 2.0 - Andreas Knecht
 
What's New in Django 1.6
What's New in Django 1.6What's New in Django 1.6
What's New in Django 1.6
 
PostgreSQL Development Today: 9.0
PostgreSQL Development Today: 9.0PostgreSQL Development Today: 9.0
PostgreSQL Development Today: 9.0
 
Crowd-sourced Automated Firefox UI Testing
Crowd-sourced Automated Firefox UI TestingCrowd-sourced Automated Firefox UI Testing
Crowd-sourced Automated Firefox UI Testing
 
Oscon 2010
Oscon 2010Oscon 2010
Oscon 2010
 
Noit ocon-2010
Noit ocon-2010Noit ocon-2010
Noit ocon-2010
 
Feature Bits at LSSC10
Feature  Bits at LSSC10Feature  Bits at LSSC10
Feature Bits at LSSC10
 
Pg big fast ugly acid
Pg big fast ugly acidPg big fast ugly acid
Pg big fast ugly acid
 
TYPO3 CMS 6.2 LTS Workshop T3DD13
TYPO3 CMS 6.2 LTS Workshop T3DD13TYPO3 CMS 6.2 LTS Workshop T3DD13
TYPO3 CMS 6.2 LTS Workshop T3DD13
 
GemStone/S Update
GemStone/S UpdateGemStone/S Update
GemStone/S Update
 
Sneak Peek of Nuxeo 5.4
Sneak Peek of Nuxeo 5.4Sneak Peek of Nuxeo 5.4
Sneak Peek of Nuxeo 5.4
 
The Art of Database Experiments – PostgresConf Silicon Valley 2018 / San Jose
The Art of Database Experiments – PostgresConf Silicon Valley 2018 / San JoseThe Art of Database Experiments – PostgresConf Silicon Valley 2018 / San Jose
The Art of Database Experiments – PostgresConf Silicon Valley 2018 / San Jose
 
Graduating To Go - A Jumpstart into the Go Programming Language
Graduating To Go - A Jumpstart into the Go Programming LanguageGraduating To Go - A Jumpstart into the Go Programming Language
Graduating To Go - A Jumpstart into the Go Programming Language
 
Batch Indexing & Near Real Time, keeping things fast
Batch Indexing & Near Real Time, keeping things fastBatch Indexing & Near Real Time, keeping things fast
Batch Indexing & Near Real Time, keeping things fast
 
Railsconf 2010
Railsconf 2010Railsconf 2010
Railsconf 2010
 

Mehr von Robert Treat

Advanced Int->Bigint Conversions
Advanced Int->Bigint ConversionsAdvanced Int->Bigint Conversions
Advanced Int->Bigint ConversionsRobert Treat
 
Explaining Explain
Explaining ExplainExplaining Explain
Explaining ExplainRobert Treat
 
the-lost-art-of-plpgsql
the-lost-art-of-plpgsqlthe-lost-art-of-plpgsql
the-lost-art-of-plpgsqlRobert Treat
 
Managing Chaos In Production: Testing vs Monitoring
Managing Chaos In Production: Testing vs MonitoringManaging Chaos In Production: Testing vs Monitoring
Managing Chaos In Production: Testing vs MonitoringRobert Treat
 
Managing Databases In A DevOps Environment 2016
Managing Databases In A DevOps Environment 2016Managing Databases In A DevOps Environment 2016
Managing Databases In A DevOps Environment 2016Robert Treat
 
Less Alarming Alerts - SRECon 2016
Less Alarming Alerts - SRECon 2016 Less Alarming Alerts - SRECon 2016
Less Alarming Alerts - SRECon 2016 Robert Treat
 
What Ops Can Learn From Design
What Ops Can Learn From DesignWhat Ops Can Learn From Design
What Ops Can Learn From DesignRobert Treat
 
Postgres 9.4 First Look
Postgres 9.4 First LookPostgres 9.4 First Look
Postgres 9.4 First LookRobert Treat
 
Less Alarming Alerts!
Less Alarming Alerts!Less Alarming Alerts!
Less Alarming Alerts!Robert Treat
 
Past, Present, and Pachyderm - All Things Open - 2013
Past, Present, and Pachyderm - All Things Open - 2013Past, Present, and Pachyderm - All Things Open - 2013
Past, Present, and Pachyderm - All Things Open - 2013Robert Treat
 
Big Bad "Upgraded" Postgres
Big Bad "Upgraded" PostgresBig Bad "Upgraded" Postgres
Big Bad "Upgraded" PostgresRobert Treat
 
Managing Databases In A DevOps Environment
Managing Databases In A DevOps EnvironmentManaging Databases In A DevOps Environment
Managing Databases In A DevOps EnvironmentRobert Treat
 
The Essential PostgreSQL.conf
The Essential PostgreSQL.confThe Essential PostgreSQL.conf
The Essential PostgreSQL.confRobert Treat
 
Advanced WAL File Management With OmniPITR
Advanced WAL File Management With OmniPITRAdvanced WAL File Management With OmniPITR
Advanced WAL File Management With OmniPITRRobert Treat
 
Scaling with Postgres (Highload++ 2010)
Scaling with Postgres (Highload++ 2010)Scaling with Postgres (Highload++ 2010)
Scaling with Postgres (Highload++ 2010)Robert Treat
 
Database Scalability Patterns
Database Scalability PatternsDatabase Scalability Patterns
Database Scalability PatternsRobert Treat
 
Scaling With Postgres
Scaling With PostgresScaling With Postgres
Scaling With PostgresRobert Treat
 
Intro to Postgres 8.4 Tutorial
Intro to Postgres 8.4 TutorialIntro to Postgres 8.4 Tutorial
Intro to Postgres 8.4 TutorialRobert Treat
 

Mehr von Robert Treat (20)

Advanced Int->Bigint Conversions
Advanced Int->Bigint ConversionsAdvanced Int->Bigint Conversions
Advanced Int->Bigint Conversions
 
Explaining Explain
Explaining ExplainExplaining Explain
Explaining Explain
 
the-lost-art-of-plpgsql
the-lost-art-of-plpgsqlthe-lost-art-of-plpgsql
the-lost-art-of-plpgsql
 
Managing Chaos In Production: Testing vs Monitoring
Managing Chaos In Production: Testing vs MonitoringManaging Chaos In Production: Testing vs Monitoring
Managing Chaos In Production: Testing vs Monitoring
 
Managing Databases In A DevOps Environment 2016
Managing Databases In A DevOps Environment 2016Managing Databases In A DevOps Environment 2016
Managing Databases In A DevOps Environment 2016
 
Less Alarming Alerts - SRECon 2016
Less Alarming Alerts - SRECon 2016 Less Alarming Alerts - SRECon 2016
Less Alarming Alerts - SRECon 2016
 
What Ops Can Learn From Design
What Ops Can Learn From DesignWhat Ops Can Learn From Design
What Ops Can Learn From Design
 
Postgres 9.4 First Look
Postgres 9.4 First LookPostgres 9.4 First Look
Postgres 9.4 First Look
 
Less Alarming Alerts!
Less Alarming Alerts!Less Alarming Alerts!
Less Alarming Alerts!
 
Past, Present, and Pachyderm - All Things Open - 2013
Past, Present, and Pachyderm - All Things Open - 2013Past, Present, and Pachyderm - All Things Open - 2013
Past, Present, and Pachyderm - All Things Open - 2013
 
Big Bad "Upgraded" Postgres
Big Bad "Upgraded" PostgresBig Bad "Upgraded" Postgres
Big Bad "Upgraded" Postgres
 
Managing Databases In A DevOps Environment
Managing Databases In A DevOps EnvironmentManaging Databases In A DevOps Environment
Managing Databases In A DevOps Environment
 
The Essential PostgreSQL.conf
The Essential PostgreSQL.confThe Essential PostgreSQL.conf
The Essential PostgreSQL.conf
 
Pro Postgres 9
Pro Postgres 9Pro Postgres 9
Pro Postgres 9
 
Advanced WAL File Management With OmniPITR
Advanced WAL File Management With OmniPITRAdvanced WAL File Management With OmniPITR
Advanced WAL File Management With OmniPITR
 
Scaling with Postgres (Highload++ 2010)
Scaling with Postgres (Highload++ 2010)Scaling with Postgres (Highload++ 2010)
Scaling with Postgres (Highload++ 2010)
 
Check Please!
Check Please!Check Please!
Check Please!
 
Database Scalability Patterns
Database Scalability PatternsDatabase Scalability Patterns
Database Scalability Patterns
 
Scaling With Postgres
Scaling With PostgresScaling With Postgres
Scaling With Postgres
 
Intro to Postgres 8.4 Tutorial
Intro to Postgres 8.4 TutorialIntro to Postgres 8.4 Tutorial
Intro to Postgres 8.4 Tutorial
 

Kürzlich hochgeladen

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
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
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 

Kürzlich hochgeladen (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
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
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 

Intro to Postgres 9 Tutorial

  • 1. PostgreSQL 9.0 / Prolog • Want to play along? • PostgreSQL 9.0 • git clone git://git.postgresql.org/git/postgresql.git • http://www.postgresql.org/docs/current/static/anoncvs.html • ./configure; make; make install; • Pagila Sample Database • http://pgfoundry.org/frs/?group_id=1000150&release_id=998 Wednesday, June 2, 2010
  • 2. No More Waiting A Guide to PostgreSQL 9.0 / Presentation / Robert Treat Wednesday, June 2, 2010
  • 3. Know More Waiting A Guide to PostgreSQL 9.0 / Presentation / Robert Treat Wednesday, June 2, 2010
  • 4. Know More Waiting A Guide to Postgres 9.0 / Presentation / Robert Treat Wednesday, June 2, 2010
  • 5. Postgres 9.0 • Performance • Administration • Development • Procedures • Replication Wednesday, June 2, 2010
  • 6. Postgres 9.0 BUT FIRST! Wednesday, June 2, 2010
  • 7. Postgres 9.0 / Recap Wednesday, June 2, 2010
  • 8. Postgres 9.0 / Recap • 8.4 Released (2009-07-01) Wednesday, June 2, 2010
  • 9. Postgres 9.0 / Recap • 8.4 Released (2009-07-01) • Commit Fests (July,September,November,January) Wednesday, June 2, 2010
  • 10. Postgres 9.0 / Recap • 8.4 Released (2009-07-01) • Commit Fests (July,September,November,January) • Alpha Release after each Commit Fest Wednesday, June 2, 2010
  • 11. Postgres 9.0 / Recap • 8.4 Released (2009-07-01) • Commit Fests (July,September,November,January) • Alpha Release after each Commit Fest • Feature Freeze (February) Wednesday, June 2, 2010
  • 12. Postgres 9.0 / Recap • 8.4 Released (2009-07-01) • Commit Fests (July,September,November,January) • Alpha Release after each Commit Fest • Feature Freeze (February) • 9.0 ?!? Wednesday, June 2, 2010
  • 13. Postgres 9.0 / Recap • 8.4 Released (2009-07-01) • Commit Fests (July,September,November,January) • Alpha Release after each Commit Fest • Feature Freeze (February) • 9.0 ?!? • Beta (April 29) Wednesday, June 2, 2010
  • 14. Postgres 9.0 / Recap • 8.4 Released (2009-07-01) • Commit Fests (July,September,November,January) • Alpha Release after each Commit Fest • Feature Freeze (February) • 9.0 ?!? • Beta (April 29) • Release (May ? June ? July) Wednesday, June 2, 2010
  • 15. Postgres 9.0 / Stats Wednesday, June 2, 2010
  • 16. Postgres 9.0 / Stats • New feature patches: 204 Wednesday, June 2, 2010
  • 17. Postgres 9.0 / Stats • New feature patches: 204 • doesn’t include direct commits Wednesday, June 2, 2010
  • 18. Postgres 9.0 / Stats • New feature patches: 204 • doesn’t include direct commits • Submitters: 84 Wednesday, June 2, 2010
  • 19. Postgres 9.0 / Stats • New feature patches: 204 • doesn’t include direct commits • Submitters: 84 • doesn’t include committers Wednesday, June 2, 2010
  • 20. Postgres 9.0 / Stats • New feature patches: 204 • doesn’t include direct commits • Submitters: 84 • doesn’t include committers • 1860 files changed Wednesday, June 2, 2010
  • 21. Postgres 9.0 / Stats • New feature patches: 204 • doesn’t include direct commits • Submitters: 84 • doesn’t include committers • 1860 files changed • 150951 insertions Wednesday, June 2, 2010
  • 22. Postgres 9.0 / Stats • New feature patches: 204 • doesn’t include direct commits • Submitters: 84 • doesn’t include committers • 1860 files changed • 150951 insertions • 82558 deletions Wednesday, June 2, 2010
  • 23. Postgres 9.0 • Performance • Administration • Development • Procedures • Replication Wednesday, June 2, 2010
  • 24. Postgres 9.0 / Perf / vacuum full Wednesday, June 2, 2010
  • 25. Postgres 9.0 / Perf / vacuum full • VACUUM FULL now works like CLUSTER • The Old • move rows around, heavy scans, bloat indexes • syntax available with VACUUM FULL INPLACE • still used for system catalogs Wednesday, June 2, 2010
  • 26. Postgres 9.0 / Perf / vacuum full • VACUUM FULL now works like CLUSTER • The Old • move rows around, heavy scans, bloat indexes • syntax available with VACUUM FULL INPLACE • still used for system catalogs • NEW • rewrite table and indexes • ~ 2% less efficient for tables, 90% more efficient for indexes • 1/3 the amount of time • continue to avoid it :-) Wednesday, June 2, 2010
  • 27. Postgres 9.0 / Perf / vacuum full Wednesday, June 2, 2010
  • 28. Postgres 9.0 / Perf / explain buffers explain can now show buffers information pagila=# explain (analyze, buffers) select * from actor; QUERY PLAN ---------------------------------------------------------------------------------------------------- Seq Scan on actor (cost=0.00..4.00 rows=200 width=25) (actual time=0.034..0.089 rows=200 loops=1) Buffers: shared read=2 Total runtime: 0.149 ms (3 rows) pagila=# explain (analyze, buffers) select count(*) from actor; QUERY PLAN --------------------------------------------------------------------------------------------------------- Aggregate (cost=4.50..4.51 rows=1 width=0) (actual time=0.109..0.109 rows=1 loops=1) Buffers: shared hit=2 -> Seq Scan on actor (cost=0.00..4.00 rows=200 width=0) (actual time=0.010..0.048 rows=200 loops=1) Buffers: shared hit=2 Total runtime: 0.173 ms (5 rows) Wednesday, June 2, 2010
  • 29. Postgres 9.0 / Perf / index not null support index use for IS NOT NULL PostgreSQL 8.4 pagila=# explain select * from address where address2 is not null; QUERY PLAN --------------------------------------------------------- Seq Scan on address (cost=0.00..20.03 rows=1 width=70) Filter: (address2 IS NOT NULL) (2 rows) PostgreSQL 9.0 Beta 1 pagila=# explain select * from address where address2 is not null; QUERY PLAN ------------------------------------------------------------------------------------- Index Scan using address_address2_idx on address (cost=0.00..8.27 rows=1 width=70) Index Cond: (address2 IS NOT NULL) (2 rows) Wednesday, June 2, 2010
  • 30. Postgres 9.0 / Perf / join removal remove joins from execution plan where not needed PostgreSQL 9.0 Alpha 4 pagila=# explain analyze select actor.last_name from actor left join film_actor using (actor_id) where actor.last_update > current_date; QUERY PLAN ------------------------------------------------------------------------------------------------------ Nested Loop Left Join (cost=4.46..38.48 rows=27 width=35) (actual time=0.258..0.258 rows=0 loops=1) -> Seq Scan on actor (cost=0.00..5.50 rows=1 width=25) (actual time=0.257..0.257 rows=0 loops=1) Filter: (last_update > ('now'::text)::date) -> Bitmap Heap Scan on film_actor (cost=4.46..32.64 rows=27 width=12) (never executed) Recheck Cond: (actor.actor_id = film_actor.actor_id) -> Bitmap Index Scan on film_actor_pkey (cost=0.00..4.45 rows=27 width=0) (never executed) Index Cond: (actor.actor_id = film_actor.actor_id) Total runtime: 0.340 ms (8 rows) this is not join removal! Wednesday, June 2, 2010
  • 31. Postgres 9.0 / Perf / join removal PostgreSQL 8.4 pagila=# explain analyze select city from city left join country using (country_id) where city.last_update > current_date; QUERY PLAN -------------------------------------------------------------------------------------------------------- Nested Loop Left Join (cost=0.00..17.95 rows=1 width=9) (actual time=28.022..28.022 rows=0 loops=1) Join Filter: (city.country_id = country.country_id) -> Seq Scan on city (cost=0.00..14.50 rows=1 width=11) (actual time=28.021..28.021 rows=0 loops=1) Filter: (last_update > ('now'::text)::date) -> Seq Scan on country (cost=0.00..2.09 rows=109 width=4) (never executed) Total runtime: 30.567 ms (6 rows) PostgreSQL 9.0 Beta 1 pagila=# explain analyze select city from city left join country using (country_id) where city.last_update > current_date; QUERY PLAN ------------------------------------------------------------------------------------------------ Seq Scan on city (cost=0.00..14.50 rows=1 width=11) (actual time=0.748..0.748 rows=0 loops=1) Filter: (last_update > ('now'::text)::date) Total runtime: 0.777 ms (3 rows) Wednesday, June 2, 2010
  • 32. Postgres 9.0 / Perf / tablespace costs Wednesday, June 2, 2010
  • 33. Postgres 9.0 / Perf / tablespace costs • Per Tablespace GUC Options • seq_page_cost • random_page_cost • ALTER TABLESPACE ... SET / RESET Wednesday, June 2, 2010
  • 34. Postgres 9.0 / Perf / tablespace costs Wednesday, June 2, 2010
  • 35. Postgres 9.0 / Perf / Wait, there’s more! Wednesday, June 2, 2010
  • 36. Postgres 9.0 / Perf / Wait, there’s more! • Increased GIN index creation for pre-ordered data • ALTER TABLE “rewrite” commands can skip xlogging • ALTER TABLE ... ALTER COLUMN ... SET DISTINCT • Optimize foo <> true => foo = false, foo <> false => foo = true • Improve pg_restore multi-workers logic for faster restores • Windows 64bit Support Wednesday, June 2, 2010
  • 37. Postgres 9.0 / Perf / Wait, there’s more! Wednesday, June 2, 2010
  • 38. Postgres 9.0 • Performance • Administration • Development • Procedures • Replication Wednesday, June 2, 2010
  • 39. Postgres 9.0 / Admin / pg_ctl initdb initdb is dead (well, to me) sa-x:postgres rob$ pgsql90/bin/pg_ctl -D data/ initdb -o "--locale=en_US.UTF-8" The files belonging to this database system will be owned by user "rob". This user must also own the server process. The database cluster will be initialized with locale en_US.UTF-8. The default database encoding has accordingly been set to UTF8. The default text search configuration will be set to "english". ... Wednesday, June 2, 2010
  • 40. Postgres 9.0 / Admin / psql greatest feature in postgres 9? sa-x:postgres rob$ pgsql90b1/bin/psql -d pagila FATAL: unrecognized configuration parameter "application_name" psql (9.0beta1, server 8.3.5) WARNING: psql version 9.0, server version 8.3. Some psql features might not work. Type "help" for help. pagila=# d actor Table "public.actor" Column | Type | Modifiers -------------+-----------------------------+---------------------------------------------------------- actor_id | integer | not null default nextval('actor_actor_id_seq'::regclass) first_name | character varying(45) | not null last_name | character varying(45) | not null last_update | timestamp without time zone | not null default now() Indexes: "actor_pkey" PRIMARY KEY, btree (actor_id) "idx_actor_last_name" btree (last_name) Referenced by: TABLE "film_actor" CONSTRAINT "film_actor_actor_id_fkey" FOREIGN KEY (actor_id) REFERENCES actor(actor_id) ON UPDATE CASCADE ON DELETE RESTRICT Triggers: last_updated BEFORE UPDATE ON actor FOR EACH ROW EXECUTE PROCEDURE last_updated() Wednesday, June 2, 2010
  • 41. Postgres 9.0 / Admin / grant all GRANT/REVOKE ON ALL object IN SCHEMA pagila=# create role dylan; CREATE ROLE pagila=# grant select on all tables in schema public to dylan; GRANT pagila=# select oid::regclass, relacl from pg_class where relkind='r' and relnamespace='2200'; oid | relacl ------------------+---------------------------------------------- film_actor | {postgres=arwdDxt/postgres,dylan=r/postgres} payment_p2007_02 | {postgres=arwdDxt/postgres,dylan=r/postgres} payment_p2007_03 | {postgres=arwdDxt/postgres,dylan=r/postgres} city | {postgres=arwdDxt/postgres,dylan=r/postgres} actor | {postgres=arwdDxt/postgres,dylan=r/postgres} category | {postgres=arwdDxt/postgres,dylan=r/postgres} film | {postgres=arwdDxt/postgres,dylan=r/postgres} address | {postgres=arwdDxt/postgres,dylan=r/postgres} store | {postgres=arwdDxt/postgres,dylan=r/postgres} staff | {postgres=arwdDxt/postgres,dylan=r/postgres} payment_p2007_04 | {postgres=arwdDxt/postgres,dylan=r/postgres} payment_p2007_05 | {postgres=arwdDxt/postgres,dylan=r/postgres} payment_p2007_06 | {postgres=arwdDxt/postgres,dylan=r/postgres} rental | {postgres=arwdDxt/postgres,dylan=r/postgres} payment_p2007_01 | {postgres=arwdDxt/postgres,dylan=r/postgres} country | {postgres=arwdDxt/postgres,dylan=r/postgres} payment | {postgres=arwdDxt/postgres,dylan=r/postgres} film_category | {postgres=arwdDxt/postgres,dylan=r/postgres} language | {postgres=arwdDxt/postgres,dylan=r/postgres} customer | {postgres=arwdDxt/postgres,dylan=r/postgres} inventory | {postgres=arwdDxt/postgres,dylan=r/postgres} Wednesday, June 2, 2010
  • 42. Postgres 9.0 / Admin / default privs ALTER DEFAULT PRIVILEGES pagila=# alter default privileges grant select on tables to dylan; ALTER DEFAULT PRIVILEGES pagila=# create table payment_p2007_07 () inherits (payment); CREATE TABLE pagila=# z payment_p2007_07 Access privileges Schema | Name | Type | Access privileges | Column access privileges --------+------------------+-------+--------------------------- +-------------------------- public | payment_p2007_07 | table | postgres=arwdDxt/postgres+| | | | dylan=r/postgres | (1 row) Wednesday, June 2, 2010
  • 43. Postgres 9.0 / Admin / d for children pagila=# d payment Table "public.payment" Column | Type | Modifiers --------------+-----------------------------+------------------------------------------------------------- payment_id | integer | not null default nextval('payment_payment_id_seq'::regclass) customer_id | smallint | not null staff_id | smallint | not null rental_id | integer | not null amount | numeric(5,2) | not null payment_date | timestamp without time zone | not null Indexes: "payment_pkey" PRIMARY KEY, btree (payment_id) "idx_fk_customer_id" btree (customer_id) "idx_fk_staff_id" btree (staff_id) "payment_rental_id_idx" btree (rental_id) Foreign-key constraints: "payment_customer_id_fkey" FOREIGN KEY (customer_id) REFERENCES customer(customer_id) ON UPDATE CASCADE ON DELETE RESTRICT "payment_rental_id_fkey" FOREIGN KEY (rental_id) REFERENCES rental(rental_id) ON UPDATE CASCADE ON DELETE SET NULL "payment_staff_id_fkey" FOREIGN KEY (staff_id) REFERENCES staff(staff_id) ON UPDATE CASCADE ON DELETE RESTRICT Rules: <snip> Number of child tables: 7 (Use d+ to list them.) Wednesday, June 2, 2010
  • 44. Postgres 9.0 / Admin / d for children pagila=# d+ payment Table "public.payment" Column | Type | Modifiers | Storage | Description --------------+-----------------------------+------------------------------------------------------------- payment_id | integer | not null default nextval('payment_payment_id_seq'::regclass) | plain | customer_id | smallint | not null | plain | staff_id | smallint | not null | plain | rental_id | integer | not null | plain | amount | numeric(5,2) | not null | main | payment_date | timestamp without time zone | not null | plain | Indexes: "payment_pkey" PRIMARY KEY, btree (payment_id) "idx_fk_customer_id" btree (customer_id) "idx_fk_staff_id" btree (staff_id) "payment_rental_id_idx" btree (rental_id) Foreign-key constraints: "payment_customer_id_fkey" FOREIGN KEY (customer_id) REFERENCES customer(customer_id) ON UPDATE CASCADE ON DELETE RESTRICT "payment_rental_id_fkey" FOREIGN KEY (rental_id) REFERENCES rental(rental_id) ON UPDATE CASCADE ON DELETE SET NULL "payment_staff_id_fkey" FOREIGN KEY (staff_id) REFERENCES staff(staff_id) ON UPDATE CASCADE ON DELETE RESTRICT Rules: <snip> Child tables: payment_p2007_01, payment_p2007_02, payment_p2007_03, payment_p2007_04, payment_p2007_05, payment_p2007_06, payment_p2007_07 Has OIDs: no Wednesday, June 2, 2010
  • 45. Postgres 9.0 / Admin / Wait, there’s more! Wednesday, June 2, 2010
  • 46. Postgres 9.0 / Admin / Wait, there’s more! • show value when unique • reindexing shared system constraints are violated catalogs is now crash safe • radius authentication • add ability to reset statistics on individual tables • add SQLSTATE as option to log_line_prefix • support samehost/samenet options in pg_hba.conf • allow collection of statistics on sequences • added string_agg function (group_concat) • GUC can now be configured based on user/database combination • improved tabular display for psql rows with null data • log changes to postgresql.conf • add index methods to di during reload Wednesday, June 2, 2010
  • 47. Postgres 9.0 / Admin / Wait, there’s more! Wednesday, June 2, 2010
  • 48. Postgres 9.0 • Performance • Administration • Development • Procedures • Replication Wednesday, June 2, 2010
  • 49. Postgres 9.0 / Dev / conditional triggers CREATE TRIGGER notify_waiting_list AFTER UPDATE ON rental FOR EACH ROW WHEN NEW.return_date <> OLD.return_date THEN EXECUTE procedure send_notices(); • improves control for execution of triggers • any boolean expression • shows up in d output • some after triggers will gain significant speed up Wednesday, June 2, 2010
  • 50. Postgres 9.0 / Dev / conditional triggers CREATE TRIGGER film_fulltext_trigger BEFORE INSERT OR UPDATE of title, description ON FILM FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('fulltext', 'pg_catalog.english', 'title', 'description') • improves control for execution of triggers • shows up in d output • simplify code • trigger only fires based on column declaration in update clause Wednesday, June 2, 2010
  • 51. Postgres 9.0 / Dev / exclusion constraints This is not the same thing as constraint exclusion! “Yes, we suck at naming things” - Magnus Hagander Wednesday, June 2, 2010
  • 52. Postgres 9.0 / Dev / exclusion constraints Wednesday, June 2, 2010
  • 53. Postgres 9.0 / Dev / exclusion constraints • Generic constraint infrastructure • UNIQUE constraints are like = • any indexable commutative operator • BETWEEN-rows constraint • each row can conflict with any other row in the table Wednesday, June 2, 2010
  • 54. Postgres 9.0 / Dev / exclusion constraints Wednesday, June 2, 2010
  • 55. Postgres 9.0 / Dev / exclusion constraints Wednesday, June 2, 2010
  • 56. Postgres 9.0 / Dev / exclusion constraints • Examples: • non-overlapping time intervals • calendars, scheduling, reservations • non-overlapping geometric shapes • zoning Wednesday, June 2, 2010
  • 57. Postgres 9.0 / Dev / exclusion constraints Wednesday, June 2, 2010
  • 58. Postgres 9.0 / Dev / exclusion constraints Jeff Davis, “Not Just Unique”, Thu @ 1:30PM Wednesday, June 2, 2010
  • 59. Postgres 9.0 / Dev / exclusion constraints • Examples: • non-overlapping time intervals • calendars, scheduling, reservations • non-overlapping geometric shapes • zoning Jeff Davis, “Not Just Unique”, Thu @ 1:30PM Wednesday, June 2, 2010
  • 60. Postgres 9.0 / Dev / exclusion constraints Jeff Davis, “Not Just Unique”, Thu @ 1:30PM Wednesday, June 2, 2010
  • 61. Postgres 9.0 / Dev / window functions pagila=# pagila=# select date_trunc('week',payment_date), sum(avg(sum(amount)) pagila-# over (order by date_trunc('week', payment_date) rows between 1 preceding and 1 following) pagila-# from payment_p2007_04 group by date_trunc('week',payment_date) order by 1; date_trunc | sum | avg ---------------------+---------+----------------------- 2007-04-02 00:00:00 | 6562.62 | 7237.2300000000000000 2007-04-09 00:00:00 | 7911.84 | 7611.8566666666666667 2007-04-23 00:00:00 | 8361.11 | 7332.2800000000000000 2007-04-30 00:00:00 | 5723.89 | 7042.5000000000000000 (4 rows) • enhancements to the frame clause • now able to compute moving averages (easily) • several options, check the docs! Wednesday, June 2, 2010
  • 62. Postgres 9.0 / Dev / Wait, there’s more! Wednesday, June 2, 2010
  • 63. Postgres 9.0 / Dev / Wait, there’s more! • deferrable unique constraints • new bytea hex format output • hstore... more efficient, kv • drop if exists columns storage • drop if exists constraints • show value when unique • ordered aggregates constraints are violated • added string_agg function • rewrite listen/notify (payloads) (group_concat) • support SQL Standard LIMIT/OFFSET Wednesday, June 2, 2010
  • 64. Postgres 9.0 / Dev / Wait, there’s more! Wednesday, June 2, 2010
  • 65. Postgres 9.0 • Performance • Administration • Development • Procedures • Replication Wednesday, June 2, 2010
  • 66. Postgres 9.0 / Proc / by default plpgsql is now created by default Wednesday, June 2, 2010
  • 67. Postgres 9.0 / Proc / just DO it! pagila=# DO $$ pagila$# DECLARE pagila$# v_part record; pagila$# v_sql text; pagila$# BEGIN pagila$# set search_path = 'public'; pagila$# for v_part in select tablename from pg_tables where tablename ~ 'payment' loop pagila$# v_sql := 'create index '||v_part.tablename||'_rental_id_idx ON '||v_part.tablename||'(rental_id)'; pagila$# raise notice '%',v_sql; pagila$# execute v_sql; pagila$# end loop; pagila$# END pagila$# $$ language plpgsql; NOTICE: create index payment_p2007_02_rental_id_idx ON payment_p2007_02(rental_id) NOTICE: create index payment_p2007_03_rental_id_idx ON payment_p2007_03(rental_id) NOTICE: create index payment_p2007_07_rental_id_idx ON payment_p2007_07(rental_id) NOTICE: create index payment_p2007_04_rental_id_idx ON payment_p2007_04(rental_id) NOTICE: create index payment_p2007_05_rental_id_idx ON payment_p2007_05(rental_id) NOTICE: create index payment_p2007_06_rental_id_idx ON payment_p2007_06(rental_id) NOTICE: create index payment_p2007_01_rental_id_idx ON payment_p2007_01(rental_id) NOTICE: create index payment_rental_id_idx ON payment(rental_id) DO pagila=# Wednesday, June 2, 2010
  • 68. Postgres 9.0 / Proc / just DO it! pagila=# di payment_p2007_0*rental* List of relations Schema | Name | Type | Owner | Table --------+--------------------------------+-------+----------+------------------ public | payment_p2007_01_rental_id_idx | index | postgres | payment_p2007_01 public | payment_p2007_02_rental_id_idx | index | postgres | payment_p2007_02 public | payment_p2007_03_rental_id_idx | index | postgres | payment_p2007_03 public | payment_p2007_04_rental_id_idx | index | postgres | payment_p2007_04 public | payment_p2007_05_rental_id_idx | index | postgres | payment_p2007_05 public | payment_p2007_06_rental_id_idx | index | postgres | payment_p2007_06 public | payment_p2007_07_rental_id_idx | index | postgres | payment_p2007_07 (7 rows) Wednesday, June 2, 2010
  • 69. Postgres 9.0 / Proc / Wait, there’s more! Wednesday, June 2, 2010
  • 70. Postgres 9.0 / Proc / Wait, there’s more! • can now use expressions in OPEN cursor FOR EXECUTE • improve variable recognition • use strict now works in plperl within plpgsql • change Perl warnings to • allow assignment of values to elog(WARNING) IN parameters • Add Python 3 support • Allow MOVE FORWARD n/ ALL, MOVE BACKWARD n/ • support for C++ stored procs ALL for plpgsql cursors • named parameters • add utility functions for plperl (quote_literal and friends) Wednesday, June 2, 2010
  • 71. Postgres 9.0 / Proc / Wait, there’s more! Wednesday, June 2, 2010
  • 72. Postgres 9.0 • Performance • Administration • Development • Procedures • Replication Wednesday, June 2, 2010
  • 73. Postgres 9.0 / repl / hot standby • allows for (read only) queries against a database during crash recovery • aka pitr replication / xlog shipping • GUC Settings • primary • wal_level = ‘hot standby’ • vacuum_defer_cleanup_age = 0 • secondary • hot_standby = on • max_standby_delay = 30s Wednesday, June 2, 2010
  • 74. Postgres 9.0 / repl / streaming replication • Process to connect to the primary from a secondary server and “stream” changes to slaves • Config primary for archive logging, then • max_wal_senders • Config secondary for streaming replication • in recovery.conf • standby_mode = on • primary_conninfo = ... • in postgresql.conf • wal_level = archive • hot_standby = on Wednesday, June 2, 2010
  • 75. Postgres 9.0 / repl / Wait, there’s more! Wednesday, June 2, 2010
  • 76. Postgres 9.0 / repl / Wait, there’s more! • actually, there isn’t any more :-) Wednesday, June 2, 2010
  • 77. Postgres 9.0 / repl / Wait, there’s more! Wednesday, June 2, 2010
  • 78. Postgres 9.0 / repl / Wait, there’s more! Heikki, “Built In-Replication”, Thu @ 10:00AM Wednesday, June 2, 2010
  • 79. Postgres 9.0 • Performance • Administration • Procedures • Tools • Replication • Bonus Round!! Wednesday, June 2, 2010
  • 80. Postgres 9.0 / Upgrades • dump / restore recommend • “pg_upgrade” (the tool formerly known as pg_migrator) • 8.3, 8.4 -> 9.0 (not dev releases) • replication • ? Wednesday, June 2, 2010
  • 81. Postgres 9.0 / Upgrades • Beware of incompatibilities • plpgsql variable conflicts • read the release notes! Wednesday, June 2, 2010
  • 82. Postgres 9.0 / Testing • Download • 9.0 Beta 1 release • git, http://github.com/gregs1104/peg • Test • import existing schemas • import existing data • run application / code tests • test new features • test pg_upgrade Wednesday, June 2, 2010
  • 83. Postgres 9.0 / More Info • http://www.depesz.com/ • http://wiki.postgresql.org/ • http://www.xzilla.net • PGCon, Ottawa, Canada, May 19th - 22nd (that’s now!) Wednesday, June 2, 2010
  • 84. Postgres 9.0 / Shout Out • Hubert Lubaczewski, aka “Depesz” • Magnus Hagander • Andreas Scherbaum • Chris Biggs • http://www.omniti.com/is/hiring Wednesday, June 2, 2010
  • 85. Thank you for listening. / Presentation Wednesday, June 2, 2010