4. https://www.2ndQuadrant.com
Where are we?
• PostgreSQL major versions released yearly
• PG 12 beta4 out Sept 12, please test
• PG 12 possibly in October 2019
• no ”killer feature”
• many incremental improvements
https://www.postgresql.org/docs/12/release-12.html
12. https://www.2ndQuadrant.com
Partial de-TOAST
• TOAST is a technique for storing large values in a separate
table (compressed by default)
• PG 11: entire value always decompressed
• PG 12: can decompress just the start of the value
• useful for:
• extracting the start of string
• PostGIS spatial joins
13. https://www.2ndQuadrant.com
Automatic inlining of CTEs
• Common table expressions (CTEs) = ”WITH clauses”
• PG 11: CTEs are evaluated before the outer query
• PG 12: CTEs are inlined into the outer query if:
• referenced only once
• not RECURSIVE
• not overridden by MATERIALIZED
• can lead to better query plans
14. https://www.2ndQuadrant.com
JIT enabled by default
• JIT (Just-In-Time) compilation arrived in PG 11
• but disabled by default
• used with longer-running queries (> 200ms)
• epecially helpful for:
• many columns
• complex expressions
15. https://www.2ndQuadrant.com
Parallel query with SERIALIZEABLE
PostgreSQL supports three transaction isolation levels: READ
COMMITTED, REPEATABLE READ, and SERIALIZABLE
• SERIALIZABLE is the strictest possible
• Parallel query in PG 9.6, but not with SERIALIZABLE
• Now all isolation levels can take advantage of parallelism
16. https://www.2ndQuadrant.com
Faster float to string conversion
• Ryu algorithm: shortest string that represents the value
precisely
• 3x faster to dump out a table of all float values
• Why do this? Because SQL Server was 4x faster
17. https://www.2ndQuadrant.com
Btree index improvements
• 10-40% smaller indexes, especially for:
• multicolumn indexes
• many duplicates
• backward compatible
• must REINDEX to remove existing bloat
• reduced locking overhead for INSERTs
22. https://www.2ndQuadrant.com
Recovery configuration in PG12
Configuration
• postgresql.conf
• ALTER SYSTEM
• some recovery
parameters can be
changed without server
restart
Signaling
• standby.signal
• recovery.signal
23. https://www.2ndQuadrant.com
Recovery configuration in PG12
Configuration
• postgresql.conf
• ALTER SYSTEM
• some recovery
parameters can be
changed without server
restart
Signaling
• standby.signal
• recovery.signal
*Every HA tool and system will
need to adapt to this*
28. https://www.2ndQuadrant.com
Partitioning DDL improvements
• The tablespace specification for a parent is now inherited
by the child
• Foreign key constraints can now refer to a partitioned table
• ALTER TABLE ... ATTACH PARTITION no longer needs
an exclusive lock
• does not block writes on parent table
• DETACH still needs an exclusive lock
31. https://www.2ndQuadrant.com
Generated columns
• only STORED option this release
• not standard but also used by other SQL implementations
• VIRTUAL likely in a future release
• can index on generated columns
• but cannot be a partition key
• COPY skips generated columns by default
32. https://www.2ndQuadrant.com
SQL/JSON Path
• JSON support in PostgreSQL since 2012
• SQL:2016 included JSON with a different API
• JSON Path is a query language for JSON documents
• analogous to XPath for XML
• PostgreSQL already has the most complete implementation
(14/15 parts)