SlideShare a Scribd company logo
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 12c
David Yahalom
 
Presentation oracle net services
Presentation    oracle net servicesPresentation    oracle net services
Presentation oracle net services
xKinAnx
 
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 Strategy
Guatemala User Group
 
Setup oracle golden gate 11g replication
Setup oracle golden gate 11g replicationSetup oracle golden gate 11g replication
Setup oracle golden gate 11g replication
Kanwar Batra
 
Postgresql Database Administration Basic - Day1
Postgresql  Database Administration Basic  - Day1Postgresql  Database Administration Basic  - Day1
Postgresql Database Administration Basic - Day1
PoguttuezhiniVP
 
Get to know PostgreSQL!
Get to know PostgreSQL!Get to know PostgreSQL!
Get to know PostgreSQL!
Oddbjørn Steffensen
 
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 Features
Embarcadero 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 - Presentation
Pini 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 Taipei
Satoshi Nagayasu
 
Oracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slidesOracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slides
Saiful
 
Managing terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets bigManaging terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets big
Selena 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 Naylor
Equnix 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 12c
Pini Dibask
 
Oracle10g New Features I
Oracle10g New Features IOracle10g New Features I
Oracle10g New Features I
Denish Patel
 
PostgreSQL Table Partitioning / Sharding
PostgreSQL Table Partitioning / ShardingPostgreSQL Table Partitioning / Sharding
PostgreSQL Table Partitioning / Sharding
Amir Reza Hashemi
 
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
Guatemala User Group
 
Oracle 12c New Features for Developers
Oracle 12c New Features for DevelopersOracle 12c New Features for Developers
Oracle 12c New Features for Developers
CompleteITProfessional
 
PostgreSQL Terminology
PostgreSQL TerminologyPostgreSQL Terminology
PostgreSQL Terminology
Showmax Engineering
 

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 ls
InSync Conference
 
Procedures and triggers in SQL
Procedures and triggers in SQLProcedures and triggers in SQL
Procedures and triggers in SQL
Vikash 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 ls
InSync 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 beyond
Tomas Vondra
 
MySQL 5.5
MySQL 5.5MySQL 5.5
MySQL 5.5
Ligaya Turmelle
 
PostgreSQL 9.5 Features
PostgreSQL 9.5 FeaturesPostgreSQL 9.5 Features
PostgreSQL 9.5 Features
Saiful
 
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
Andrew Dunstan
 
Less04 Instance
Less04 InstanceLess04 Instance
Less04 Instance
vivaankumar
 
Reducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLReducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQL
Kenny 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 Know
Alex 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 I
Carlos Oliveira
 
Introduction to Parallel Execution
Introduction to Parallel ExecutionIntroduction to Parallel Execution
Introduction to Parallel Execution
Doug Burns
 
Dynamic websites lec3
Dynamic websites lec3Dynamic websites lec3
Dynamic websites lec3
Belal Arfa
 
Intro to tsql
Intro to tsqlIntro to tsql
Intro to tsql
Syed Asrarali
 
Intro to tsql unit 14
Intro to tsql   unit 14Intro to tsql   unit 14
Intro to tsql unit 14
Syed 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.1
MariaDB 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.1
MariaDB plc
 
12c Database new features
12c Database new features12c Database new features
12c Database new features
Sandeep 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 DBaaS
EDB
 
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
EDB
 
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, 2021
EDB
 
Benchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQLBenchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQL
EDB
 
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
EDB
 
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
EDB
 
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 PostgreSQL
EDB
 
Practical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresPractical Partitioning in Production with Postgres
Practical Partitioning in Production with Postgres
EDB
 
A Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAINA Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAIN
EDB
 
IOT with PostgreSQL
IOT with PostgreSQLIOT with PostgreSQL
IOT with PostgreSQL
EDB
 
A Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQLA Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQL
EDB
 
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 - APJ
EDB
 
Comment sauvegarder correctement vos données
Comment sauvegarder correctement vos donnéesComment sauvegarder correctement vos données
Comment sauvegarder correctement vos données
EDB
 
Cloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - ItalianoCloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - Italiano
EDB
 
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
EDB
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQL
EDB
 
Cloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJCloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJ
EDB
 

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

Redefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI CapabilitiesRedefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI Capabilities
Priyanka Aash
 
"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx
"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx
"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx
Fwdays
 
Choosing the Best Outlook OST to PST Converter: Key Features and Considerations
Choosing the Best Outlook OST to PST Converter: Key Features and ConsiderationsChoosing the Best Outlook OST to PST Converter: Key Features and Considerations
Choosing the Best Outlook OST to PST Converter: Key Features and Considerations
webbyacad software
 
Indian Privacy law & Infosec for Startups
Indian Privacy law & Infosec for StartupsIndian Privacy law & Infosec for Startups
Indian Privacy law & Infosec for Startups
AMol NAik
 
Keynote : AI & Future Of Offensive Security
Keynote : AI & Future Of Offensive SecurityKeynote : AI & Future Of Offensive Security
Keynote : AI & Future Of Offensive Security
Priyanka Aash
 
FIDO Munich Seminar: FIDO Tech Principles.pptx
FIDO Munich Seminar: FIDO Tech Principles.pptxFIDO Munich Seminar: FIDO Tech Principles.pptx
FIDO Munich Seminar: FIDO Tech Principles.pptx
FIDO Alliance
 
Perth MuleSoft Meetup July 2024
Perth MuleSoft Meetup July 2024Perth MuleSoft Meetup July 2024
Perth MuleSoft Meetup July 2024
Michael Price
 
Cracking AI Black Box - Strategies for Customer-centric Enterprise Excellence
Cracking AI Black Box - Strategies for Customer-centric Enterprise ExcellenceCracking AI Black Box - Strategies for Customer-centric Enterprise Excellence
Cracking AI Black Box - Strategies for Customer-centric Enterprise Excellence
Quentin Reul
 
Increase Quality with User Access Policies - July 2024
Increase Quality with User Access Policies - July 2024Increase Quality with User Access Policies - July 2024
Increase Quality with User Access Policies - July 2024
Peter Caitens
 
Generative AI technology is a fascinating field that focuses on creating comp...
Generative AI technology is a fascinating field that focuses on creating comp...Generative AI technology is a fascinating field that focuses on creating comp...
Generative AI technology is a fascinating field that focuses on creating comp...
Nohoax Kanont
 
Camunda Chapter NY Meetup July 2024.pptx
Camunda Chapter NY Meetup July 2024.pptxCamunda Chapter NY Meetup July 2024.pptx
Camunda Chapter NY Meetup July 2024.pptx
ZachWylie3
 
Scaling Vector Search: How Milvus Handles Billions+
Scaling Vector Search: How Milvus Handles Billions+Scaling Vector Search: How Milvus Handles Billions+
Scaling Vector Search: How Milvus Handles Billions+
Zilliz
 
Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...
Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...
Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...
OnBoard
 
Enterprise_Mobile_Security_Forum_2013.pdf
Enterprise_Mobile_Security_Forum_2013.pdfEnterprise_Mobile_Security_Forum_2013.pdf
Enterprise_Mobile_Security_Forum_2013.pdf
Yury Chemerkin
 
It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...
Zilliz
 
Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17
Bhajan Mehta
 
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan..."Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
Fwdays
 
FIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Munich Seminar In-Vehicle Payment Trends.pptxFIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Alliance
 
Discovery Series - Zero to Hero - Task Mining Session 1
Discovery Series - Zero to Hero - Task Mining Session 1Discovery Series - Zero to Hero - Task Mining Session 1
Discovery Series - Zero to Hero - Task Mining Session 1
DianaGray10
 
Self-Healing Test Automation Framework - Healenium
Self-Healing Test Automation Framework - HealeniumSelf-Healing Test Automation Framework - Healenium
Self-Healing Test Automation Framework - Healenium
Knoldus Inc.
 

Recently uploaded (20)

Redefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI CapabilitiesRedefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI Capabilities
 
"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx
"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx
"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx
 
Choosing the Best Outlook OST to PST Converter: Key Features and Considerations
Choosing the Best Outlook OST to PST Converter: Key Features and ConsiderationsChoosing the Best Outlook OST to PST Converter: Key Features and Considerations
Choosing the Best Outlook OST to PST Converter: Key Features and Considerations
 
Indian Privacy law & Infosec for Startups
Indian Privacy law & Infosec for StartupsIndian Privacy law & Infosec for Startups
Indian Privacy law & Infosec for Startups
 
Keynote : AI & Future Of Offensive Security
Keynote : AI & Future Of Offensive SecurityKeynote : AI & Future Of Offensive Security
Keynote : AI & Future Of Offensive Security
 
FIDO Munich Seminar: FIDO Tech Principles.pptx
FIDO Munich Seminar: FIDO Tech Principles.pptxFIDO Munich Seminar: FIDO Tech Principles.pptx
FIDO Munich Seminar: FIDO Tech Principles.pptx
 
Perth MuleSoft Meetup July 2024
Perth MuleSoft Meetup July 2024Perth MuleSoft Meetup July 2024
Perth MuleSoft Meetup July 2024
 
Cracking AI Black Box - Strategies for Customer-centric Enterprise Excellence
Cracking AI Black Box - Strategies for Customer-centric Enterprise ExcellenceCracking AI Black Box - Strategies for Customer-centric Enterprise Excellence
Cracking AI Black Box - Strategies for Customer-centric Enterprise Excellence
 
Increase Quality with User Access Policies - July 2024
Increase Quality with User Access Policies - July 2024Increase Quality with User Access Policies - July 2024
Increase Quality with User Access Policies - July 2024
 
Generative AI technology is a fascinating field that focuses on creating comp...
Generative AI technology is a fascinating field that focuses on creating comp...Generative AI technology is a fascinating field that focuses on creating comp...
Generative AI technology is a fascinating field that focuses on creating comp...
 
Camunda Chapter NY Meetup July 2024.pptx
Camunda Chapter NY Meetup July 2024.pptxCamunda Chapter NY Meetup July 2024.pptx
Camunda Chapter NY Meetup July 2024.pptx
 
Scaling Vector Search: How Milvus Handles Billions+
Scaling Vector Search: How Milvus Handles Billions+Scaling Vector Search: How Milvus Handles Billions+
Scaling Vector Search: How Milvus Handles Billions+
 
Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...
Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...
Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...
 
Enterprise_Mobile_Security_Forum_2013.pdf
Enterprise_Mobile_Security_Forum_2013.pdfEnterprise_Mobile_Security_Forum_2013.pdf
Enterprise_Mobile_Security_Forum_2013.pdf
 
It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...
 
Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17
 
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan..."Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
 
FIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Munich Seminar In-Vehicle Payment Trends.pptxFIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Munich Seminar In-Vehicle Payment Trends.pptx
 
Discovery Series - Zero to Hero - Task Mining Session 1
Discovery Series - Zero to Hero - Task Mining Session 1Discovery Series - Zero to Hero - Task Mining Session 1
Discovery Series - Zero to Hero - Task Mining Session 1
 
Self-Healing Test Automation Framework - Healenium
Self-Healing Test Automation Framework - HealeniumSelf-Healing Test Automation Framework - Healenium
Self-Healing Test Automation Framework - Healenium
 

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