what's new in postgresql 9.4
DESCRIPTION
A sneak peek at what's coming in PostgreSQL 9.4. Many more things will be added before the beta is released. But hopefully this will give an idea what's already there.TRANSCRIPT
PostgreSQL 9.4 Sneak PeekPavan DeolaseeMarch 28, 2014
India PostgreSQL User Group MeetupHyderabad
Who am I ? Pavan Deolasee
� http://www.linkedin.com/in/pavandeolasee PostgreSQL/Postgres-XC Consultant Contributor to PostgreSQL and Postgres-XC Global
Development� Best known for development of Heap-Only-Tuple (HOT)
feature� Contributed several other enhancements to PostgreSQL
and derivatives� Contributed to Postgres-XC's architectural design and
implementation of several features Previously worked for EnterpriseDB and Symantec/Veritas
PostgreSQL Recap
• is world's most advanced open source database• is very stable• is fully compliant with ANSI SQL• supports foreign key, check constraints• supports various kinds of indexes• supports inheritance • Is fully extensible (data types, procedural languages
etc)• supports ACID transactions• will recover your database in case of server failure
PostgreSQL Recap• uses write-ahead-logs for durability and recover your
database in case of• server failure• built-in log based streaming
synchronous/asynchronous replication• file system level backups and archive recovery• point-in-time recovery• hot standby• upgrade in place• full-text search• and many more
Configuration/Admin• Read-only GUC to show if data checksum is enabled or not
– Useful to know if the server is initialized with data checksums on/off.
– Previously, user must look at pg_control to get this information
• New autovacuum_work_mem parameter– Separates it from the work_mem parameter
• A GUC to enable WAL-logging of hint bits, even with checksums disabled.– Turn this on if you want to use external tools such as
pg_rewind to quickly get you old master join the replication as a new standby
– More WAL generated, so be aware of the performance impact
Configuration/Admin• A GUC, max_worker_processes, limiting number of
bgworkers.• A GUC, session_preload_libraries, specifying preload
libraries at session startup– Takes effect at backend start– Doesn’t require a full server restart
• A new pg_stat_archiver statistics view.• Improve EXPLAIN to print the grouping columns in Agg
and Group nodes.• Default work_mem and maintenance_work_mem
increased by 4x
SQL Improvements
• Revive line typeCREATE TABLE LINE_TBL (s line);
• Represented by• Equation Ax + By + C = 0
INSERT INTO LINE_TBL VALUES ('{1,-1,1}');
• Two points (x1, y1), (x2, y2) INSERT INTO LINE_TBL VALUES ('(0,0),(6,6)');
SQL Improvements• Allow only some columns of a view to be auto-
updateable.
CREATE TABLE base_tbl(a float);CREATE VIEW rw_view1 AS SELECT ctid, sin(a) s, a, cos(a) c
FROM base_tbl WHERE a != 0;
INSERT INTO rw_view1 VALUES (null, null, 1.1, null); -- should fail
INSERT INTO rw_view1 (a) VALUES (1.1) RETURNING a, s, c;-- OK
UPDATE rw_view1 SET s = s WHERE a = 1.1;-- should fail
SQL Improvements
• Materialized Views - Support for REFRESH CONCURRENTLY– Readers won’t be blocked while a MatView is being
refreshed• WITH CHECK OPTION support for auto-updatable
VIEWs– INSERTs/UPDATEs not satisfying the view visibility will
be rejected– LOCAL CHECK only checks against the current view– CASCADE CHECK checks against all the underlying
views
SQL Improvements• Provide a FORCE NULL option to COPY in CSV mode.
– Forces an input field containing the quoted null string to be returned as a NULL. Without this option, only unquoted null strings behave this way.
– Helps where some CSV producers insist on quoting every field, whether or not it is needed.
– Takes a list of fields, and only applies to those columns.
CREATE TEMP TABLE forcetest (a INT NOT NULL, b TEXT NOT NULL, c TEXT, d TEXT, e TEXT);\pset null NULLCOPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NOT_NULL(b), FORCE_NULL(c));
SQL Improvements
• DISCARD SEQUENCES command.– Will discard cached values for sequences
• Allow empty target list in SELECT• WITHIN GROUP and ordered-set aggregates• Support multi-argument UNNEST(), and
TABLE() syntax for multiple functions.
Developer Features
• Improve support for building PGXS modules with VPATH.
• Use an MVCC snapshot, rather than SnapshotNow, for catalog scans.
• Dynamic background worker threads• Allow background workers to be started dynamically.• Single-reader, single-writer, lightweight shared
message queue.• Allow on-detach callbacks for dynamic shared memory
segments.
Security
• SSL: Add configuration option to prefer server cipher order
• SSL: Support ECDH key exchange• Rework SSL renegotiation code
Performance
• Change the way tuples are marked as frozen.– Xmin is preserved for forensic analysis and debugging.– Allows aggressive freezing of tuples without fear of
lossing critical debugging information• Aggressively freeze tables when CLUSTER or VACUUM
FULL rewrites them.• Include planning time in EXPLAIN ANALYZE output.• Improve performance of numeric sum(), avg(),
stddev(), variance(), etc.• Improve performance of COPY with default nextval()
Performance
• Only WAL-log the modified portion in an UPDATE, if possible.
• Improve scalability of WAL insertions.• Allow using huge TLB pages on Linux
(MAP_HUGETLB)• Speed up "rare & frequent" type GIN queries.
Replication
• Allow time delayed standbys and recovery– Set min_recovery_apply_delay to force a delay
in recovery apply– Delay is measured between WAL record time
and local standby time.• If multiple recovery_targets are specified, use
the latest one.
Logical Replication (WIP)
• Introduce logical decoding.– Fine granular replication– Bi-directional replication
• Add new wal_level, logical, sufcient for logical decoding.
• Add the notion of REPLICA IDENTITY for a table.
• Allow logical decoding via the walsender interface.
Resources
• Release Notes• Planet PostgreSQL• Documentation• Source Code
3/30/14 18