21
What’s New in Postgres 9.4 BRUCE MOMJIAN December, 2014 POSTGRESQL is an open-source, full-featured relational database. This presentation gives an overview of the Postgres 9.4 release. Creative Commons Attribution License http://momjian.us/presentations 1 / 21

What's New in Postgres 9.4

Embed Size (px)

Citation preview

Page 1: What's New in Postgres 9.4

What’s New in Postgres 9.4

BRUCE MOMJIAN

December, 2014

POSTGRESQL is an open-source, full-featured relational database.This presentation gives an overview of the Postgres 9.4 release.Creative Commons Attribution License http://momjian.us/presentations

1 / 21

Page 2: What's New in Postgres 9.4

PostgreSQL the database…

◮ Open Source Object Relational DBMS since 1996

◮ Distributed under the PostgreSQL License

◮ Similar technical heritage as Oracle, SQL Server & DB2

◮ However, a strong adherence to standards (ANSI-SQL 2008)

◮ Highly extensible and adaptable design

◮ Languages, indexing, data types, etc.◮ E.g. PostGIS, JSONB, SQL/MED

◮ Extensive use throughout the world for applications andorganizations of all types

◮ Bundled into Red Hat Enterprise Linux, Ubuntu, CentOSand Amazon Linux

What’s New in Postgres 9.4 2 / 21

Page 3: What's New in Postgres 9.4

PostgreSQL the community…

◮ Independent community led by a Core Team of six

◮ Large, active and vibrant community

◮ www.postgresql.org

◮ Downloads, Mailing lists, Documentation

◮ Sponsors sampler:

◮ Google, Red Hat, VMWare, Skype, Salesforce, HP andEnterpriseDB

◮ http://www.postgresql.org/community/

What’s New in Postgres 9.4 3 / 21

Page 4: What's New in Postgres 9.4

EnterpriseDB the company…

◮ The worldwide leader of Postgres based products andservices founded in 2004

◮ Customers include 50 of the Fortune 500 and 98 of theForbes Global 2000

◮ Enterprise offerings:

◮ PostgreSQL Support, Services and Training◮ Postgres Plus Advanced Server with Oracle Compatibility◮ Tools for Monitoring, Replication, HA, Backup & Recovery

Community

◮ Citizenship

◮ Contributor of key features: Materialized Views, JSON, &more

◮ Nine community members on staff

What’s New in Postgres 9.4 4 / 21

Page 5: What's New in Postgres 9.4

EnterpriseDB the company…

What’s New in Postgres 9.4 5 / 21

Page 6: What's New in Postgres 9.4

9.4 Feature Outline

1. Allow materialized views to be refreshed without blocking reads

2. Logical decoding allows database changes to be streamed outin a customizable format

3. Allow background workers to be dynamically registered, startedand terminated

4. Add structured (non-text) data type (JSONB) for storing JSONdata

5. Add SQL-level ALTER SYSTEM command to edit thepostgresql.conf configuration file

6. GIN indexes are 5x smaller and faster for multi-key lookups

7. Improve WAL performance

8. User-configurable delay of streaming replication

Released 2014

What’s New in Postgres 9.4 6 / 21

Page 7: What's New in Postgres 9.4

1. Allow Non-Blocking Materialized View Refresh

◮ Allows materialized view refresh without blocking reads

◮ Enabled with CONCURRENTLY keyword

◮ Requires a unique index

REFRESH MATERIALIZED VIEW CONCURRENTLY matview_test_view;

What’s New in Postgres 9.4 7 / 21

Page 8: What's New in Postgres 9.4

2.Logical Decoding

Logical decoding allows database changes to be optionallystreamed in a configurable format. The data is read from theWAL and transformed into the desired target format, which canbe easily processed by external tools. In previous releases, onlybinary changes were recorded in the WAL. This will be used formulti-master replication, zero-downtime major upgrades, writeauditing, cache invalidation, and finer-grained replication control.

What’s New in Postgres 9.4 8 / 21

Page 9: What's New in Postgres 9.4

2.Logical Decoding Example

In postgresql.conf:

wal_level = logicalmax_replication_slots = 1

From SQL:

SELECT * FROM pg_create_logical_replication_slot(’regression_slot’,’test_decoding’);

slot_name | xlog_position-----------------+---------------regression_slot | 0/16E63E0

What’s New in Postgres 9.4 9 / 21

Page 10: What's New in Postgres 9.4

2.Logical Decoding Example

CREATE TABLE data(id serial primary key, data text);BEGIN;INSERT INTO data(data) VALUES(’1’);INSERT INTO data(data) VALUES(’2’);COMMIT;SELECT * FROM pg_logical_slot_get_changes(’regression_slot’, NULL, NULL);location | xid | data-----------+-----+---------------------------------------------------------0/16E6410 | 688 | BEGIN 6880/16F7F70 | 688 | COMMIT 6880/16F8080 | 689 | BEGIN 6890/16F8080 | 689 | table public.data: INSERT: id[integer]:1 data[text]:’1’0/16F8148 | 689 | table public.data: INSERT: id[integer]:2 data[text]:’2’0/16F8218 | 689 | COMMIT 689

What’s New in Postgres 9.4 10 / 21

Page 11: What's New in Postgres 9.4

3. Dynamic Control of Background Workers

◮ Registered

◮ Started

◮ Terminated

◮ Also shared memory dynamic control and message queuesupport

This will be used to support parallel query.

What’s New in Postgres 9.4 11 / 21

Page 12: What's New in Postgres 9.4

4. Binary JSON Support (JSONB)

◮ Allows rapid access to JSON keys and values

◮ Flexible indexing options, including indexing of all keys andvalues (the default), or all key/value combinations(jsonb_path_ops)

CREATE TABLE json_demo(data JSONB);CREATE INDEX i_json_demo ON json_demo USING gin (data);

What’s New in Postgres 9.4 12 / 21

Page 13: What's New in Postgres 9.4

5. SQL Control of postgresql.conf

This allows postgresql.conf values to be modified via SQL.

SHOW work_mem;work_mem----------4MBALTER SYSTEM SET work_mem = ’30MB’;SELECT pg_reload_conf();-- postgresql.conf settings are pushed to running sessionsSHOW work_mem;work_mem----------30MB

What’s New in Postgres 9.4 13 / 21

Page 14: What's New in Postgres 9.4

6. GIN Indexes Are Smaller and Faster

◮ Typical index shrank from 58MB to 11MB using varbyteencoding of item pointers

◮ Advantages of bitmap indexes, without the limitations

◮ When doing AND index matches, rare items are looked upfirst, reducing lookups of more common values

What’s New in Postgres 9.4 14 / 21

Page 15: What's New in Postgres 9.4

7. Improve WAL Performance

◮ Allow parallel inserts into WAL

◮ Only write modified fields into WAL, rather than entire rows

What’s New in Postgres 9.4 15 / 21

Page 16: What's New in Postgres 9.4

8. User-Configurable Delay of Streaming Replication

◮ Controlled by recovery_min_apply_delay

◮ Useful for recovering from mistakes

What’s New in Postgres 9.4 16 / 21

Page 17: What's New in Postgres 9.4

PostgreSQL Future

What’s New in Postgres 9.4 17 / 21

Page 18: What's New in Postgres 9.4

PostgreSQL Evolution

1996

1986

13 Years

2001

1998

2012

Crash Enterprise FlexibilitySQL Standards

Flexibility includes:

◮ Application-specific data types, e.g. JSON, PostGIS, rangetypes

◮ Advanced index types, e.g. GIN, SP-GiST

◮ Single and multi-node scalability

What’s New in Postgres 9.4 18 / 21

Page 19: What's New in Postgres 9.4

Three Focuses

Keith Alsheimer, EnterpriseDB

What’s New in Postgres 9.4 19 / 21

Page 20: What's New in Postgres 9.4

Additional Resources…

◮ Postgres Downloads:

◮ www.enterprisedb.com/downloads

◮ Product and Services information:

[email protected]

What’s New in Postgres 9.4 20 / 21

Page 21: What's New in Postgres 9.4

Conclusion

http://momjian.us/presentations http://www.flickr.com/photos/timlawrenz/

What’s New in Postgres 9.4 21 / 21