Slide 1

Slide 1 text

What's New for Developer's in PostgreSQL 17 Deepak Mahto DataCloudGaze Consulting

Slide 2

Slide 2 text

© 2024 All Rights Reserved About Me I am Deepak Mahto, and I like to call myself your Database Guy. ● Founder at DataCloudGaze Consulting. ● Conduct training on PostgreSQL and Migration at DatabaseGyaan. ● Loves to blog on Databases Learnings. ● I live in Mumbai and have a 3-year-old child. ● Loves to explore street food.

Slide 3

Slide 3 text

© 2024 All Rights Reserved Agenda ● Key upcoming features in PostgreSQL 17 for Developers. ○ Optimizer ○ Utility Command ○ Partitions ○ Merge ○ PL/pgSQL ○ Partitions ○ JSON ○ Trigger ○ Privilege ○ And more..

Slide 4

Slide 4 text

PostgreSQL 17 - Optimizer Sections

Slide 5

Slide 5 text

© 2024 All Rights Reserved Optimizer - Null Constraints and Performance. Improve optimization of IS NOT NULL and IS NULL query restrictions.

Slide 6

Slide 6 text

© 2024 All Rights Reserved Optimizer - Null Constraints and Performance. Improve optimization of IS NOT NULL and IS NULL query restrictions.

Slide 7

Slide 7 text

© 2024 All Rights Reserved Optimizer - enable_group_by_reordering Allow GROUP BY columns to be internally ordered for better plan.

Slide 8

Slide 8 text

© 2024 All Rights Reserved Optimizer - enable_group_by_reordering Allow GROUP BY columns to be internally ordered for better plan.

Slide 9

Slide 9 text

© 2024 All Rights Reserved Optimizer - Correlated IN Clause Transformation. Allow correlated IN subqueries to be transformed into optimal joins PG16

Slide 10

Slide 10 text

© 2024 All Rights Reserved Optimizer - Correlated IN Clause Transformation. Allow correlated IN subqueries to be transformed into optimal joins

Slide 11

Slide 11 text

© 2024 All Rights Reserved Optimizer - Improve CTE Plans Use CTE columns statistics and sort order for better plan and estimates. PG16

Slide 12

Slide 12 text

© 2024 All Rights Reserved Optimizer - Improve CTE Plans Use CTE columns statistics and sort order for better plan and estimates.

Slide 13

Slide 13 text

PostgreSQL 17 - PL/pgSQL

Slide 14

Slide 14 text

© 2024 All Rights Reserved PL/pgSQL - New Array Declaration Allow plpgsql %TYPE and %ROWTYPE specifications to represent arrays of non array type.

Slide 15

Slide 15 text

PostgreSQL 17 - Utility Command

Slide 16

Slide 16 text

© 2024 All Rights Reserved Utility Command - Explain (Memory) Allow EXPLAIN to report optimizer memory usage

Slide 17

Slide 17 text

© 2024 All Rights Reserved Utility Command - Explain (serialize) Allow Explain command to show overhead of convert and de-toasting and sending it over the wire.

Slide 18

Slide 18 text

© 2024 All Rights Reserved Utility Command - Copy New option to ignore Bad record and Track it with Verbosity option.

Slide 19

Slide 19 text

© 2024 All Rights Reserved Utility Command - Copy ● Handling data type incompatibilities with ON_ERROR options ● Improved logging with LOG_VERBOSITY ● Observability via pg_stat_progress_copy with tuples_skipped

Slide 20

Slide 20 text

© 2024 All Rights Reserved Utility Command - Copy command is more user friendly

Slide 21

Slide 21 text

© 2024 All Rights Reserved Utility Command - tuples_skipped

Slide 22

Slide 22 text

PostgreSQL 17 - New JSON Functions.

Slide 23

Slide 23 text

© 2024 All Rights Reserved SQL/JSON Function - JSON_TABLE JSON_TABLE() to convert JSON data to a table representation

Slide 24

Slide 24 text

© 2024 All Rights Reserved SQL/JSON Constructor Functions

Slide 25

Slide 25 text

© 2024 All Rights Reserved SQL/JSON query functions

Slide 26

Slide 26 text

PostgreSQL 17 - Partitions.

Slide 27

Slide 27 text

© 2024 All Rights Reserved Partition - Identity Column support

Slide 28

Slide 28 text

© 2024 All Rights Reserved Partition - Split existing Partition Support Reverted in 17 Beta 3

Slide 29

Slide 29 text

© 2024 All Rights Reserved Partition - Merge existing Partition Support Reverted in 17 Beta 3

Slide 30

Slide 30 text

PostgreSQL 17 - Merge

Slide 31

Slide 31 text

© 2024 All Rights Reserved Merge Command in PostgreSQL 17

Slide 32

Slide 32 text

© 2024 All Rights Reserved Merge Command in PostgreSQL 17 Fun Fact: Internal Join Strategies in PostgreSQL 17 MERGE

Slide 33

Slide 33 text

© 2024 All Rights Reserved Merge Command in PostgreSQL 17 New merge_action() Function: Highlights operations performed on the target table, now with added support for the RETURNING clause.

Slide 34

Slide 34 text

PostgreSQL 17 - psql command line

Slide 35

Slide 35 text

© 2024 All Rights Reserved Allow psql's \watch to stop after a min number of rows returned

Slide 36

Slide 36 text

PostgreSQL 17 - Server Configuration

Slide 37

Slide 37 text

© 2024 All Rights Reserved Terminating connection due to transaction_timeout Set timeout for Transactions that can help to overcome vacuum and table bloat challenges.

Slide 38

Slide 38 text

© 2024 All Rights Reserved Terminating connection due to transaction_timeout

Slide 39

Slide 39 text

© 2024 All Rights Reserved Configurable SLRU cache ● Postgres 17 adds configurable SLRU cache sizes to boost performance in large workloads. ● Splitting SLRU caches into multiple banks with locks enhances scalability. ● Configuration changes require a restart, key for workloads facing contention

Slide 40

Slide 40 text

PostgreSQL 17 - Privileges

Slide 41

Slide 41 text

© 2024 All Rights Reserved Privileges - maintain / pg_maintain at user level. Allow granting the right to perform maintenance operations

Slide 42

Slide 42 text

PostgreSQL 17 - Builtin Collation

Slide 43

Slide 43 text

© 2024 All Rights Reserved New Builtin Collation ● Built-in collation provider with UTF-8 encoding ● Provides sorting semantics similar to 'C' collation ● Guaranteed immutable for consistent sort results across systems

Slide 44

Slide 44 text

PostgreSQL 17 - Event Trigger on Logon

Slide 45

Slide 45 text

© 2024 All Rights Reserved Event Triggers - Login Implement login related usecases using login Event Trigger

Slide 46

Slide 46 text

© 2024 All Rights Reserved Event Triggers - Login in action

Slide 47

Slide 47 text

© 2024 All Rights Reserved Getting Started and Test your self. docker run -d --name=pg17b3 -e POSTGRES_PASSWORD=************ postgres:17beta3 -p 5432:5435 docker exec -it pg17b3 psql -h localhost -U postgres -d postgres Running PostgreSQL 17 Beta within Docker.

Slide 48

Slide 48 text

© 2024 All Rights Reserved Thank you! https://www.datacloudgaze.com/ https://www.linkedin.com/in/mahtodeepak/ https://x.com/mahtodeepak05 https://databaserookies.wordpress.com/ Code : PGHYD30 , 30% off https://www.databasegyaan.com