SlideShare a Scribd company logo
1 of 24
Download to read offline
Major Features: Postgres 11
BRUCE MOMJIAN
POSTGRESQL is an open-source, full-featured relational database.
This presentation gives an overview of the Postgres 11 release.
Creative Commons Attribution License http://momjian.us/presentations
Last updated: September, 2018
1 / 24
Postgres 11 Feature Outline
1. Partitioning improvements
2. Parallelism improvements
3. Stored procedures with transaction control
4. Executor-stage compilation
5. Prevent table rewrite for ALTER TABLE … ADD COLUMN with
non-NULL default
6. Finer-grained access control
7. Write-ahead log (WAL) improvements
8. Allow ’quit’ and ’exit’ to exit psql
9. Miscellaneous
Full item list at https://www.postgresql.org/docs/devel/static/
release-11.html
2 / 24
1. Partitioning Improvements
◮ Partitioning syntax added in Postgres 10
◮ simplified administration
◮ Postgres 11
◮ faster partition pruning during optimization
◮ executor-level partition pruning, e.g., for joins
◮ hash partitioning
◮ move updated rows to new partitions
◮ allow a default partition for non-matching rows
◮ allow unique/primary indexes when the partition key is
included, and allow foreign keys to reference them
◮ more items
3 / 24
Hash Partitioning Example
-- hash partition
CREATE TABLE part_test (x int, y text) PARTITION BY hash (x);
-- create child partitions
CREATE TABLE part_test_0 PARTITION OF part_test FOR VALUES
WITH (MODULUS 4, REMAINDER 0);
CREATE TABLE part_test_1 PARTITION OF part_test FOR VALUES
WITH (MODULUS 4, REMAINDER 1);
CREATE TABLE part_test_2 PARTITION OF part_test FOR VALUES
WITH (MODULUS 4, REMAINDER 2);
CREATE TABLE part_test_3 PARTITION OF part_test FOR VALUES
WITH (MODULUS 4, REMAINDER 3);
4 / 24
Partitioning Row Migration
-- insert 1k rows
INSERT INTO part_test SELECT generate_series(0, 999), ’old’;
-- What partition contains row zero?
SELECT relname
FROM pg_class
WHERE oid = (SELECT tableoid FROM part_test WHERE x = 0);
relname
-------------
part_test_0
-- change row zero to row 1003
UPDATE part_test SET x = 1003, y = ’new’ WHERE x = 0;
--What partition contains row 1003? Values are hashed twice.
SELECT relname
FROM pg_class
WHERE oid = (SELECT tableoid FROM part_test WHERE x = 1003);
relname
-------------
part_test_1
5 / 24
Partitioning Row Distribution
-- How are the rows distributed?
SELECT name, y, COUNT(*)
FROM part_test, LATERAL (
SELECT relname
FROM pg_class
WHERE pg_class.oid = part_test.tableoid) AS table_name (name)
GROUP BY name, y
ORDER BY 1, 2;
name | y | count
-------------+-----+-------
part_test_0 | old | 258
part_test_1 | new | 1
part_test_1 | old | 234
part_test_2 | old | 276
part_test_3 | old | 231
6 / 24
Range Partitioning Example
-- range partition
CREATE TABLE part_test2 (instant TIMESTAMP WITH TIME ZONE, description TEXT)
PARTITION BY RANGE (instant);
CREATE TABLE part_test2_2017 PARTITION OF part_test2 FOR VALUES
FROM (’2017-01-01’) TO (’2018-01-01’);
CREATE TABLE part_test2_2018 PARTITION OF part_test2 FOR VALUES
FROM (’2018-01-01’) TO (’2019-01-01’);
-- create default partition
CREATE TABLE part_test2_default PARTITION OF part_test2 DEFAULT;
-- add primary key to parent table
ALTER TABLE part_test2 ADD PRIMARY KEY (instant);
7 / 24
Default Partition
-- insert two years of rows
INSERT INTO part_test2
SELECT generate_series(’2017-01-01’::timestamptz,
’2018-12-31’, ’1 day’), ’rain’;
-- insert rows outside of the defined range
INSERT INTO part_test2 VALUES (’2019-02-20’, ’snow’);
SELECT name, COUNT(*)
FROM part_test2, LATERAL (
SELECT relname
FROM pg_class
WHERE pg_class.oid = part_test2.tableoid) AS table_name (name)
GROUP BY name
ORDER BY 1;
name | count
--------------------+-------
part_test2_2017 | 365
part_test2_2018 | 365
part_test2_default | 1
8 / 24
2. Parallelism Improvements
◮ Parallel btree index builds
◮ Parallel hash joins
◮ Parallelize individual SELECTs in UNION
◮ Seven more items
9 / 24
3. Stored Procedures with Transaction Control
◮ Similar to functions
◮ allows transaction commit and abort blocks inside procedures
◮ returns no values
◮ commands prohibited in transaction blocks are still
prohibited in procedures, e.g., VACUUM
◮ inner transactions cannot be committed independently of
outer transactions, i.e., no autonomous transactions
◮ Supported languages
◮ PL/pgSQL
◮ PL/Perl
◮ PL/Python
◮ PL/Tcl
◮ SPI
10 / 24
Stored Procedure Example
CREATE TABLE system (status text NOT NULL);
-- no more than one row in the table
CREATE UNIQUE INDEX ON system ((true));
CREATE TABLE customer (name TEXT, sales_monthly_total NUMERIC(10,2));
CREATE TABLE employee (name TEXT, sales_monthly_total NUMERIC(10,2));
11 / 24
Stored Procedure Example
CREATE PROCEDURE end_of_month_processing() AS $$
BEGIN
INSERT INTO system VALUES (’end-of-month processing’)
ON CONFLICT ((true)) DO UPDATE SET status = excluded.status;
-- allow all sessions to see the new status
COMMIT;
UPDATE customer SET sales_monthly_total = 0;
UPDATE employee SET sales_monthly_total = 0;
INSERT INTO system VALUES (’normal operation’)
ON CONFLICT ((true)) DO UPDATE SET STATUS = excluded.status;
-- allow all sessions to see the new status
COMMIT;
-- inform managers only after complete
PERFORM email_managers(’end-of-month processing complete’);
END
$$ LANGUAGE plpgsql;
CALL end_of_month_processing();
12 / 24
Stored Procedure Example
CREATE TABLE web_session (data JSONB, last_active TIMESTAMP WITH TIME ZONE);
-- add five web sessions
INSERT INTO web_session
SELECT ’{"abc": 1}’, CURRENT_TIMESTAMP
FROM generate_series(1, 5);
13 / 24
Stored Procedure Example
CREATE PROCEDURE expire_web_sessions(min_expire INTERVAL) AS $$
DECLARE
rows INTEGER;
BEGIN
WHILE TRUE LOOP
-- clock_timestamp() is updated on every loop
DELETE FROM web_session WHERE last_active < clock_timestamp()-min_expire;
GET DIAGNOSTICS rows = ROW_COUNT;
COMMIT;
RAISE NOTICE ’% rows deleted’, rows;
-- check at half of expiration time
PERFORM pg_sleep(EXTRACT(EPOCH FROM min_expire) / 2);
END LOOP;
END
$$ LANGUAGE plpgsql;
CALL expire_web_sessions(’15 minutes’);
NOTICE: 0 rows deleted
NOTICE: 0 rows deleted
NOTICE: 5 rows deleted
NOTICE: 0 rows deleted
14 / 24
4. Executor-Stage Compilation
utility
Plan
Optimal Path
Query
Generate Plan
Traffic Cop
Generate Paths
Execute Plan
e.g. CREATE TABLE, COPY
SELECT, INSERT, UPDATE, DELETE
Rewrite Query
Parse Statement
Utility
Command
15 / 24
Executor-Stage Compilation
utility
Optimal Path
Query
Plan
Plan with Ojbect Code
Execute Plan
Just−in−Time Compiler
Object Code
Generate Plan
Traffic Cop
Generate Paths
e.g. CREATE TABLE, COPY
SELECT, INSERT, UPDATE, DELETE
Rewrite Query
Parse Statement
Utility
Command
16 / 24
5. Prevent Table Rewrite For ALTER TABLE …
ADD COLUMN with Non-NULL Default
-- Postgres 10
CREATE TABLE alter_test (id SERIAL, name TEXT);
INSERT INTO alter_test (name) SELECT repeat(’x’, 100);
SELECT relfilenode FROM pg_class WHERE relname = ’alter_test’;
relfilenode
-------------
16439
ALTER TABLE alter_test ADD COLUMN col1 INTEGER;
SELECT relfilenode FROM pg_class WHERE relname = ’alter_test’;
relfilenode
-------------
16439
ALTER TABLE alter_test ADD COLUMN col2 INTEGER DEFAULT 1;
SELECT relfilenode FROM pg_class WHERE relname = ’alter_test’;
relfilenode
-------------
16447
17 / 24
Prevent Table Rewrite For ALTER TABLE …
ADD COLUMN with Non-NULL Default
-- Postgres 11
CREATE TABLE alter_test (id SERIAL, name TEXT);
INSERT INTO alter_test (name) SELECT repeat(’x’, 100);
SELECT relfilenode FROM pg_class WHERE relname = ’alter_test’;
relfilenode
-------------
16388
ALTER TABLE alter_test ADD COLUMN col1 INTEGER;
SELECT relfilenode FROM pg_class WHERE relname = ’alter_test’;
relfilenode
-------------
16388
ALTER TABLE alter_test ADD COLUMN col2 INTEGER DEFAULT 1;
SELECT relfilenode FROM pg_class WHERE relname = ’alter_test’;
relfilenode
-------------
16388
18 / 24
6. Finer-Grained Access Control
◮ Superuser-only file system access now controlled by role
membership
◮ pg_read_server_files
◮ pg_write_server_files
◮ pg_execute_server_program
◮ Superuser-only access to file system functions now controlled
by function execute permissions
◮ pg_ls_dir()
◮ pg_read_file()
◮ pg_read_binary_file()
◮ pg_stat_file()
◮ Superuser-only import/export of large objects now controlled
by function execute permissions
◮ lo_import()
◮ lo_export()
19 / 24
7. Write-Ahead Log (WAL) Improvements
◮ Allow WAL file size to be specified via initdb or pg_resetwal
◮ default still 16MB
◮ larger files simplify WAL archiving for active clusters
◮ Halve number of WAL files kept in pg_wal
◮ Zero trailing bytes during forced WAL switch
20 / 24
8. Allow ’quit’ and ’exit’ to Exit Psql
$ psql test
psql (11beta3)
Type "help" for help.
test=> quit
$ psql test
psql (11beta3)
Type "help" for help.
test=> exit
$ psql test
psql (11beta3)
Type "help" for help.
test=> SELECT
test-> quit
Use q to quit.
test-> q
21 / 24
Allow ’quit’ and ’exit’ to Exit Psql
$ psql test
psql (11beta3)
Type "help" for help.
test=> quit
test-> exit
test-> q
$ psql test
psql (11beta3)
Type "help" for help.
test=> SELECT ’
test’> q
Use control-D to quit.
test’> ^D
22 / 24
9. Miscellaneous
◮ Allow unique indexes to contain non-unique columns via
INCLUDE
◮ additional columns can be used for index lookups or
index-only scans
◮ Window function improvements
◮ Add extensions to convert JSONB data to/from PL/Perl and
PL/Python
◮ Add support for large pages on Windows
◮ Allow pg_prewarm to restore previous shared buffer contents
◮ Allow a password prompt for TLS private key access
◮ Sharding advances
23 / 24
Conclusion
http://momjian.us/presentations https://www.flickr.com/photos/8113246@N02/
24 / 24

More Related Content

What's hot

The Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cThe Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cDavid Yahalom
 
Presentation oracle net services
Presentation    oracle net servicesPresentation    oracle net services
Presentation oracle net servicesxKinAnx
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PGConf APAC
 
Crating a Robust Performance Strategy
Crating a Robust Performance StrategyCrating a Robust Performance Strategy
Crating a Robust Performance StrategyGuatemala User Group
 
Setup oracle golden gate 11g replication
Setup oracle golden gate 11g replicationSetup oracle golden gate 11g replication
Setup oracle golden gate 11g replicationKanwar Batra
 
Postgresql Database Administration Basic - Day1
Postgresql  Database Administration Basic  - Day1Postgresql  Database Administration Basic  - Day1
Postgresql Database Administration Basic - Day1PoguttuezhiniVP
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
Dan Hotka's Top 10 Oracle 12c New Features
Dan Hotka's Top 10 Oracle 12c New FeaturesDan Hotka's Top 10 Oracle 12c New Features
Dan Hotka's Top 10 Oracle 12c New FeaturesEmbarcadero Technologies
 
Ensuring Data Protection Using Oracle Flashback Features - Presentation
Ensuring Data Protection Using Oracle Flashback Features - PresentationEnsuring Data Protection Using Oracle Flashback Features - Presentation
Ensuring Data Protection Using Oracle Flashback Features - PresentationPini Dibask
 
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 TaipeiPostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 TaipeiSatoshi Nagayasu
 
Oracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slidesOracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slidesSaiful
 
Managing terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets bigManaging terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets bigSelena Deckelmann
 
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John NaylorPGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John NaylorEqunix Business Solutions
 
Best New Features of Oracle Database 12c
Best New Features of Oracle Database 12cBest New Features of Oracle Database 12c
Best New Features of Oracle Database 12cPini Dibask
 
Oracle10g New Features I
Oracle10g New Features IOracle10g New Features I
Oracle10g New Features IDenish Patel
 
PostgreSQL Table Partitioning / Sharding
PostgreSQL Table Partitioning / ShardingPostgreSQL Table Partitioning / Sharding
PostgreSQL Table Partitioning / ShardingAmir Reza Hashemi
 
Oracle 12c New Features for Developers
Oracle 12c New Features for DevelopersOracle 12c New Features for Developers
Oracle 12c New Features for DevelopersCompleteITProfessional
 

What's hot (20)

The Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cThe Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12c
 
Presentation oracle net services
Presentation    oracle net servicesPresentation    oracle net services
Presentation oracle net services
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
 
Crating a Robust Performance Strategy
Crating a Robust Performance StrategyCrating a Robust Performance Strategy
Crating a Robust Performance Strategy
 
Setup oracle golden gate 11g replication
Setup oracle golden gate 11g replicationSetup oracle golden gate 11g replication
Setup oracle golden gate 11g replication
 
Postgresql Database Administration Basic - Day1
Postgresql  Database Administration Basic  - Day1Postgresql  Database Administration Basic  - Day1
Postgresql Database Administration Basic - Day1
 
Get to know PostgreSQL!
Get to know PostgreSQL!Get to know PostgreSQL!
Get to know PostgreSQL!
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
Dan Hotka's Top 10 Oracle 12c New Features
Dan Hotka's Top 10 Oracle 12c New FeaturesDan Hotka's Top 10 Oracle 12c New Features
Dan Hotka's Top 10 Oracle 12c New Features
 
Ensuring Data Protection Using Oracle Flashback Features - Presentation
Ensuring Data Protection Using Oracle Flashback Features - PresentationEnsuring Data Protection Using Oracle Flashback Features - Presentation
Ensuring Data Protection Using Oracle Flashback Features - Presentation
 
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 TaipeiPostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
 
Oracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slidesOracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slides
 
Managing terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets bigManaging terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets big
 
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John NaylorPGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
 
Best New Features of Oracle Database 12c
Best New Features of Oracle Database 12cBest New Features of Oracle Database 12c
Best New Features of Oracle Database 12c
 
Oracle10g New Features I
Oracle10g New Features IOracle10g New Features I
Oracle10g New Features I
 
PostgreSQL Table Partitioning / Sharding
PostgreSQL Table Partitioning / ShardingPostgreSQL Table Partitioning / Sharding
PostgreSQL Table Partitioning / Sharding
 
RMAN – The Pocket Knife of a DBA
RMAN – The Pocket Knife of a DBA RMAN – The Pocket Knife of a DBA
RMAN – The Pocket Knife of a DBA
 
Oracle 12c New Features for Developers
Oracle 12c New Features for DevelopersOracle 12c New Features for Developers
Oracle 12c New Features for Developers
 
PostgreSQL Terminology
PostgreSQL TerminologyPostgreSQL Terminology
PostgreSQL Terminology
 

Similar to Major features postgres 11

Tony jambu (obscure) tools of the trade for tuning oracle sq ls
Tony jambu   (obscure) tools of the trade for tuning oracle sq lsTony jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
 
Procedures and triggers in SQL
Procedures and triggers in SQLProcedures and triggers in SQL
Procedures and triggers in SQLVikash Sharma
 
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu   (obscure) tools of the trade for tuning oracle sq lsTony Jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
 
Performance improvements in PostgreSQL 9.5 and beyond
Performance improvements in PostgreSQL 9.5 and beyondPerformance improvements in PostgreSQL 9.5 and beyond
Performance improvements in PostgreSQL 9.5 and beyondTomas Vondra
 
PostgreSQL 9.5 Features
PostgreSQL 9.5 FeaturesPostgreSQL 9.5 Features
PostgreSQL 9.5 FeaturesSaiful
 
PostgreSQL 8.4 TriLUG 2009-11-12
PostgreSQL 8.4 TriLUG 2009-11-12PostgreSQL 8.4 TriLUG 2009-11-12
PostgreSQL 8.4 TriLUG 2009-11-12Andrew Dunstan
 
Reducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLReducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLKenny Gryp
 
DBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowDBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ICarlos Oliveira
 
Introduction to Parallel Execution
Introduction to Parallel ExecutionIntroduction to Parallel Execution
Introduction to Parallel ExecutionDoug Burns
 
Dynamic websites lec3
Dynamic websites lec3Dynamic websites lec3
Dynamic websites lec3Belal Arfa
 
Intro to tsql unit 14
Intro to tsql   unit 14Intro to tsql   unit 14
Intro to tsql unit 14Syed Asrarali
 
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1MariaDB plc
 
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1MariaDB plc
 
12c Database new features
12c Database new features12c Database new features
12c Database new featuresSandeep Redkar
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Alex Zaballa
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)Dave Stokes
 

Similar to Major features postgres 11 (20)

Tony jambu (obscure) tools of the trade for tuning oracle sq ls
Tony jambu   (obscure) tools of the trade for tuning oracle sq lsTony jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
 
Procedures and triggers in SQL
Procedures and triggers in SQLProcedures and triggers in SQL
Procedures and triggers in SQL
 
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu   (obscure) tools of the trade for tuning oracle sq lsTony Jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
 
Performance improvements in PostgreSQL 9.5 and beyond
Performance improvements in PostgreSQL 9.5 and beyondPerformance improvements in PostgreSQL 9.5 and beyond
Performance improvements in PostgreSQL 9.5 and beyond
 
MySQL 5.5
MySQL 5.5MySQL 5.5
MySQL 5.5
 
PostgreSQL 9.5 Features
PostgreSQL 9.5 FeaturesPostgreSQL 9.5 Features
PostgreSQL 9.5 Features
 
PostgreSQL 8.4 TriLUG 2009-11-12
PostgreSQL 8.4 TriLUG 2009-11-12PostgreSQL 8.4 TriLUG 2009-11-12
PostgreSQL 8.4 TriLUG 2009-11-12
 
Less04 Instance
Less04 InstanceLess04 Instance
Less04 Instance
 
Reducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLReducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQL
 
DBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowDBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should Know
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices I
 
Introduction to Parallel Execution
Introduction to Parallel ExecutionIntroduction to Parallel Execution
Introduction to Parallel Execution
 
Dynamic websites lec3
Dynamic websites lec3Dynamic websites lec3
Dynamic websites lec3
 
Intro to tsql
Intro to tsqlIntro to tsql
Intro to tsql
 
Intro to tsql unit 14
Intro to tsql   unit 14Intro to tsql   unit 14
Intro to tsql unit 14
 
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
 
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
 
12c Database new features
12c Database new features12c Database new features
12c Database new features
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
 

More from EDB

Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
Cloud Migration Paths: Kubernetes, IaaS, or DBaaSCloud Migration Paths: Kubernetes, IaaS, or DBaaS
Cloud Migration Paths: Kubernetes, IaaS, or DBaaSEDB
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr UnternehmenDie 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr UnternehmenEDB
 
Migre sus bases de datos Oracle a la nube
Migre sus bases de datos Oracle a la nube Migre sus bases de datos Oracle a la nube
Migre sus bases de datos Oracle a la nube EDB
 
EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021EDB
 
Benchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQLBenchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQLEDB
 
Las Variaciones de la Replicación de PostgreSQL
Las Variaciones de la Replicación de PostgreSQLLas Variaciones de la Replicación de PostgreSQL
Las Variaciones de la Replicación de PostgreSQLEDB
 
NoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQLNoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQLEDB
 
Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?EDB
 
Data Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQLData Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQLEDB
 
Practical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresPractical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresEDB
 
A Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAINA Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAINEDB
 
IOT with PostgreSQL
IOT with PostgreSQLIOT with PostgreSQL
IOT with PostgreSQLEDB
 
A Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQLA Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQLEDB
 
Psql is awesome!
Psql is awesome!Psql is awesome!
Psql is awesome!EDB
 
EDB 13 - New Enhancements for Security and Usability - APJ
EDB 13 - New Enhancements for Security and Usability - APJEDB 13 - New Enhancements for Security and Usability - APJ
EDB 13 - New Enhancements for Security and Usability - APJEDB
 
Comment sauvegarder correctement vos données
Comment sauvegarder correctement vos donnéesComment sauvegarder correctement vos données
Comment sauvegarder correctement vos donnéesEDB
 
Cloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - ItalianoCloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - ItalianoEDB
 
New enhancements for security and usability in EDB 13
New enhancements for security and usability in EDB 13New enhancements for security and usability in EDB 13
New enhancements for security and usability in EDB 13EDB
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLEDB
 
Cloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJCloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJEDB
 

More from EDB (20)

Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
Cloud Migration Paths: Kubernetes, IaaS, or DBaaSCloud Migration Paths: Kubernetes, IaaS, or DBaaS
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr UnternehmenDie 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
 
Migre sus bases de datos Oracle a la nube
Migre sus bases de datos Oracle a la nube Migre sus bases de datos Oracle a la nube
Migre sus bases de datos Oracle a la nube
 
EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021
 
Benchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQLBenchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQL
 
Las Variaciones de la Replicación de PostgreSQL
Las Variaciones de la Replicación de PostgreSQLLas Variaciones de la Replicación de PostgreSQL
Las Variaciones de la Replicación de PostgreSQL
 
NoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQLNoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQL
 
Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?
 
Data Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQLData Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQL
 
Practical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresPractical Partitioning in Production with Postgres
Practical Partitioning in Production with Postgres
 
A Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAINA Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAIN
 
IOT with PostgreSQL
IOT with PostgreSQLIOT with PostgreSQL
IOT with PostgreSQL
 
A Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQLA Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQL
 
Psql is awesome!
Psql is awesome!Psql is awesome!
Psql is awesome!
 
EDB 13 - New Enhancements for Security and Usability - APJ
EDB 13 - New Enhancements for Security and Usability - APJEDB 13 - New Enhancements for Security and Usability - APJ
EDB 13 - New Enhancements for Security and Usability - APJ
 
Comment sauvegarder correctement vos données
Comment sauvegarder correctement vos donnéesComment sauvegarder correctement vos données
Comment sauvegarder correctement vos données
 
Cloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - ItalianoCloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - Italiano
 
New enhancements for security and usability in EDB 13
New enhancements for security and usability in EDB 13New enhancements for security and usability in EDB 13
New enhancements for security and usability in EDB 13
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQL
 
Cloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJCloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJ
 

Recently uploaded

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
 
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
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
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
 
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
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
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
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
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
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
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
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
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
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 

Recently uploaded (20)

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
 
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
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
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
 
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
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
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
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
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
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
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
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
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
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 

Major features postgres 11

  • 1. Major Features: Postgres 11 BRUCE MOMJIAN POSTGRESQL is an open-source, full-featured relational database. This presentation gives an overview of the Postgres 11 release. Creative Commons Attribution License http://momjian.us/presentations Last updated: September, 2018 1 / 24
  • 2. Postgres 11 Feature Outline 1. Partitioning improvements 2. Parallelism improvements 3. Stored procedures with transaction control 4. Executor-stage compilation 5. Prevent table rewrite for ALTER TABLE … ADD COLUMN with non-NULL default 6. Finer-grained access control 7. Write-ahead log (WAL) improvements 8. Allow ’quit’ and ’exit’ to exit psql 9. Miscellaneous Full item list at https://www.postgresql.org/docs/devel/static/ release-11.html 2 / 24
  • 3. 1. Partitioning Improvements ◮ Partitioning syntax added in Postgres 10 ◮ simplified administration ◮ Postgres 11 ◮ faster partition pruning during optimization ◮ executor-level partition pruning, e.g., for joins ◮ hash partitioning ◮ move updated rows to new partitions ◮ allow a default partition for non-matching rows ◮ allow unique/primary indexes when the partition key is included, and allow foreign keys to reference them ◮ more items 3 / 24
  • 4. Hash Partitioning Example -- hash partition CREATE TABLE part_test (x int, y text) PARTITION BY hash (x); -- create child partitions CREATE TABLE part_test_0 PARTITION OF part_test FOR VALUES WITH (MODULUS 4, REMAINDER 0); CREATE TABLE part_test_1 PARTITION OF part_test FOR VALUES WITH (MODULUS 4, REMAINDER 1); CREATE TABLE part_test_2 PARTITION OF part_test FOR VALUES WITH (MODULUS 4, REMAINDER 2); CREATE TABLE part_test_3 PARTITION OF part_test FOR VALUES WITH (MODULUS 4, REMAINDER 3); 4 / 24
  • 5. Partitioning Row Migration -- insert 1k rows INSERT INTO part_test SELECT generate_series(0, 999), ’old’; -- What partition contains row zero? SELECT relname FROM pg_class WHERE oid = (SELECT tableoid FROM part_test WHERE x = 0); relname ------------- part_test_0 -- change row zero to row 1003 UPDATE part_test SET x = 1003, y = ’new’ WHERE x = 0; --What partition contains row 1003? Values are hashed twice. SELECT relname FROM pg_class WHERE oid = (SELECT tableoid FROM part_test WHERE x = 1003); relname ------------- part_test_1 5 / 24
  • 6. Partitioning Row Distribution -- How are the rows distributed? SELECT name, y, COUNT(*) FROM part_test, LATERAL ( SELECT relname FROM pg_class WHERE pg_class.oid = part_test.tableoid) AS table_name (name) GROUP BY name, y ORDER BY 1, 2; name | y | count -------------+-----+------- part_test_0 | old | 258 part_test_1 | new | 1 part_test_1 | old | 234 part_test_2 | old | 276 part_test_3 | old | 231 6 / 24
  • 7. Range Partitioning Example -- range partition CREATE TABLE part_test2 (instant TIMESTAMP WITH TIME ZONE, description TEXT) PARTITION BY RANGE (instant); CREATE TABLE part_test2_2017 PARTITION OF part_test2 FOR VALUES FROM (’2017-01-01’) TO (’2018-01-01’); CREATE TABLE part_test2_2018 PARTITION OF part_test2 FOR VALUES FROM (’2018-01-01’) TO (’2019-01-01’); -- create default partition CREATE TABLE part_test2_default PARTITION OF part_test2 DEFAULT; -- add primary key to parent table ALTER TABLE part_test2 ADD PRIMARY KEY (instant); 7 / 24
  • 8. Default Partition -- insert two years of rows INSERT INTO part_test2 SELECT generate_series(’2017-01-01’::timestamptz, ’2018-12-31’, ’1 day’), ’rain’; -- insert rows outside of the defined range INSERT INTO part_test2 VALUES (’2019-02-20’, ’snow’); SELECT name, COUNT(*) FROM part_test2, LATERAL ( SELECT relname FROM pg_class WHERE pg_class.oid = part_test2.tableoid) AS table_name (name) GROUP BY name ORDER BY 1; name | count --------------------+------- part_test2_2017 | 365 part_test2_2018 | 365 part_test2_default | 1 8 / 24
  • 9. 2. Parallelism Improvements ◮ Parallel btree index builds ◮ Parallel hash joins ◮ Parallelize individual SELECTs in UNION ◮ Seven more items 9 / 24
  • 10. 3. Stored Procedures with Transaction Control ◮ Similar to functions ◮ allows transaction commit and abort blocks inside procedures ◮ returns no values ◮ commands prohibited in transaction blocks are still prohibited in procedures, e.g., VACUUM ◮ inner transactions cannot be committed independently of outer transactions, i.e., no autonomous transactions ◮ Supported languages ◮ PL/pgSQL ◮ PL/Perl ◮ PL/Python ◮ PL/Tcl ◮ SPI 10 / 24
  • 11. Stored Procedure Example CREATE TABLE system (status text NOT NULL); -- no more than one row in the table CREATE UNIQUE INDEX ON system ((true)); CREATE TABLE customer (name TEXT, sales_monthly_total NUMERIC(10,2)); CREATE TABLE employee (name TEXT, sales_monthly_total NUMERIC(10,2)); 11 / 24
  • 12. Stored Procedure Example CREATE PROCEDURE end_of_month_processing() AS $$ BEGIN INSERT INTO system VALUES (’end-of-month processing’) ON CONFLICT ((true)) DO UPDATE SET status = excluded.status; -- allow all sessions to see the new status COMMIT; UPDATE customer SET sales_monthly_total = 0; UPDATE employee SET sales_monthly_total = 0; INSERT INTO system VALUES (’normal operation’) ON CONFLICT ((true)) DO UPDATE SET STATUS = excluded.status; -- allow all sessions to see the new status COMMIT; -- inform managers only after complete PERFORM email_managers(’end-of-month processing complete’); END $$ LANGUAGE plpgsql; CALL end_of_month_processing(); 12 / 24
  • 13. Stored Procedure Example CREATE TABLE web_session (data JSONB, last_active TIMESTAMP WITH TIME ZONE); -- add five web sessions INSERT INTO web_session SELECT ’{"abc": 1}’, CURRENT_TIMESTAMP FROM generate_series(1, 5); 13 / 24
  • 14. Stored Procedure Example CREATE PROCEDURE expire_web_sessions(min_expire INTERVAL) AS $$ DECLARE rows INTEGER; BEGIN WHILE TRUE LOOP -- clock_timestamp() is updated on every loop DELETE FROM web_session WHERE last_active < clock_timestamp()-min_expire; GET DIAGNOSTICS rows = ROW_COUNT; COMMIT; RAISE NOTICE ’% rows deleted’, rows; -- check at half of expiration time PERFORM pg_sleep(EXTRACT(EPOCH FROM min_expire) / 2); END LOOP; END $$ LANGUAGE plpgsql; CALL expire_web_sessions(’15 minutes’); NOTICE: 0 rows deleted NOTICE: 0 rows deleted NOTICE: 5 rows deleted NOTICE: 0 rows deleted 14 / 24
  • 15. 4. Executor-Stage Compilation utility Plan Optimal Path Query Generate Plan Traffic Cop Generate Paths Execute Plan e.g. CREATE TABLE, COPY SELECT, INSERT, UPDATE, DELETE Rewrite Query Parse Statement Utility Command 15 / 24
  • 16. Executor-Stage Compilation utility Optimal Path Query Plan Plan with Ojbect Code Execute Plan Just−in−Time Compiler Object Code Generate Plan Traffic Cop Generate Paths e.g. CREATE TABLE, COPY SELECT, INSERT, UPDATE, DELETE Rewrite Query Parse Statement Utility Command 16 / 24
  • 17. 5. Prevent Table Rewrite For ALTER TABLE … ADD COLUMN with Non-NULL Default -- Postgres 10 CREATE TABLE alter_test (id SERIAL, name TEXT); INSERT INTO alter_test (name) SELECT repeat(’x’, 100); SELECT relfilenode FROM pg_class WHERE relname = ’alter_test’; relfilenode ------------- 16439 ALTER TABLE alter_test ADD COLUMN col1 INTEGER; SELECT relfilenode FROM pg_class WHERE relname = ’alter_test’; relfilenode ------------- 16439 ALTER TABLE alter_test ADD COLUMN col2 INTEGER DEFAULT 1; SELECT relfilenode FROM pg_class WHERE relname = ’alter_test’; relfilenode ------------- 16447 17 / 24
  • 18. Prevent Table Rewrite For ALTER TABLE … ADD COLUMN with Non-NULL Default -- Postgres 11 CREATE TABLE alter_test (id SERIAL, name TEXT); INSERT INTO alter_test (name) SELECT repeat(’x’, 100); SELECT relfilenode FROM pg_class WHERE relname = ’alter_test’; relfilenode ------------- 16388 ALTER TABLE alter_test ADD COLUMN col1 INTEGER; SELECT relfilenode FROM pg_class WHERE relname = ’alter_test’; relfilenode ------------- 16388 ALTER TABLE alter_test ADD COLUMN col2 INTEGER DEFAULT 1; SELECT relfilenode FROM pg_class WHERE relname = ’alter_test’; relfilenode ------------- 16388 18 / 24
  • 19. 6. Finer-Grained Access Control ◮ Superuser-only file system access now controlled by role membership ◮ pg_read_server_files ◮ pg_write_server_files ◮ pg_execute_server_program ◮ Superuser-only access to file system functions now controlled by function execute permissions ◮ pg_ls_dir() ◮ pg_read_file() ◮ pg_read_binary_file() ◮ pg_stat_file() ◮ Superuser-only import/export of large objects now controlled by function execute permissions ◮ lo_import() ◮ lo_export() 19 / 24
  • 20. 7. Write-Ahead Log (WAL) Improvements ◮ Allow WAL file size to be specified via initdb or pg_resetwal ◮ default still 16MB ◮ larger files simplify WAL archiving for active clusters ◮ Halve number of WAL files kept in pg_wal ◮ Zero trailing bytes during forced WAL switch 20 / 24
  • 21. 8. Allow ’quit’ and ’exit’ to Exit Psql $ psql test psql (11beta3) Type "help" for help. test=> quit $ psql test psql (11beta3) Type "help" for help. test=> exit $ psql test psql (11beta3) Type "help" for help. test=> SELECT test-> quit Use q to quit. test-> q 21 / 24
  • 22. Allow ’quit’ and ’exit’ to Exit Psql $ psql test psql (11beta3) Type "help" for help. test=> quit test-> exit test-> q $ psql test psql (11beta3) Type "help" for help. test=> SELECT ’ test’> q Use control-D to quit. test’> ^D 22 / 24
  • 23. 9. Miscellaneous ◮ Allow unique indexes to contain non-unique columns via INCLUDE ◮ additional columns can be used for index lookups or index-only scans ◮ Window function improvements ◮ Add extensions to convert JSONB data to/from PL/Perl and PL/Python ◮ Add support for large pages on Windows ◮ Allow pg_prewarm to restore previous shared buffer contents ◮ Allow a password prompt for TLS private key access ◮ Sharding advances 23 / 24