Post on 14-Apr-2017
What’s New InPostgreSQL 9.6And MySQL 8.0
Baron Schwartz - October 2016
Introductions & Agenda
Ask questions anytime and/or mention @VividCortex in a tweet, or use #DBUpdates.
Q & A time at the end.
Slides and recording will be posted.
Contact me personally: baron@vividcortex.com or @xaprb
A Couple Of ThingsTerminology
● Planner -vs- optimizer
● Standby -vs- slave
● WAL -vs- redo log
● Purge -vs- VACUUM
● Tuple -vs- row
Pronunciation
● “My Sequel” or “My S-Q-L” are both fine
● “Post gress” or “Post gress Q-L” are fine
○ “Post greeee” not so much
What’s The Status?
PostgreSQL 9.6 was released Sept 29th, and is GA.
● Release Announcement: https://www.postgresql.org/about/news/1703/
MySQL 8.0 is in pre-release status, and some features are “labs.”
● What’s New: https://dev.mysql.com/doc/refman/8.0/en/mysql-nutshell.html
● There’s likely to be a lot more before the GA release.
HighlightsPostgres 9.6
● Multi-core execution of queries
● Efficiency and Performance
● Extensibility
● Replication and scale-out
MySQL 8.0
● Operability, Reliability, Performance
● Catch-up on SQL support
● Prepare for replica-set sharding
● Document Store (JSON+X Protocol)
NOTE: Builds on significant improvements in 5.7
Performance: MVCC, Purge, Checkpointing
● MVCC-related capabilities address difficult tradeoffs.
● Edge-case workloads often cause “pauses.”
Performance: MVCC, Purge, Checkpointing
Postgres 9.6
● Avoid GIN index bloating
● GIN is a generalized inverted index
Performance: MVCC, Purge, Checkpointing
Postgres 9.6
● Make VACUUM do less wasted work.
● Doesn’t re-VACUUM pages that haven’t changed.
● Big improvement on data warehouse-style servers.
● Big win when data changes only rarely.
Postgres 9.6
● Timeouts for MVCC snapshots and idle transactions.
○ Both features address related issues.
○ old_snapshot_threshold
○ idle_in_transaction_session_timeout
● Faster visibility checks for new tuples.
Performance: MVCC, Purge, Checkpointing
Performance: General
Postgres 9.6
● A lot of locking-related performance improvements.
● Big improvements on multicore systems.
● Ordered writes of dirtied pages during checkpointing.
● Ability to instruct the OS to flush more smartly.
Performance: General
MySQL 8.0
● ALTER TABLE performance improved.
● Temp tables for ALTER aren’t logged to redo log.
● Many other improvements e.g. INFORMATION_SCHEMA.
● Buffer pool mutex is split into several mutexes.
Indexing Improvements
Postgres 9.6
● Improvements for GiST indexes.
● Improvements for GIN indexes.
● More efficient index-only scans.
MySQL 8.0
● Support for indexing columns in descending order.
● Improves queries where mixed-order indexing helps.
● Note - backwards index scans have always worked.
Indexing Improvements
Planning / Query Optimization
Postgres 9.6
● Better column statistics.
● Better selectivity estimates.
Planning / Query Optimization
MySQL 8.0
● More robust optimizer hints.
● Invisible indexes.
● Better optimizer statistics and histograms.
Replication
Postgres 9.6
● Better observability for replication slots.
● Reserved replication slots.
● Multiple standbys for sync replication.
○ Configurable number for acking commits.
● New setting to ensure transactions are applied.
Postgres 9.6
● Improvements to start a new standby from a base backup.
● Ability to rewind a standby to a previous state.
● Many indirect improvements to replication.
○ Example - improved locking
Replication
MySQL 8.0
● Group Replication is making rapid progress.
Replication
ObservabilityPostgres 9.6
● More pg_stat_… views
○ VACUUM observability
○ Replication
○ Blocking/blockers
● Internally: wait events
○ Basis for future improvement
Observability
MySQL 8.0
● Much faster INFORMATION_SCHEMA
● PERFORMANCE_SCHEMA has indexes now
● Errors are instrumented in P_S
● Buffer pool index pages inspectability
● Slightly better insight into row-based replication apply
Authentication and Security
Postgres 9.6
● More sophisticated integration with external auth.
● More built-in roles that can do useful things.
Authentication and Security
MySQL 8.0
● Adds ROLEs.
OperabilityPostgres 9.6
● Easier to create a standby from a base backup.
● Monitoring/observability improvements.
● Easier to see things like config options.
● More reliable replication.
○ Replication improvement = recovery improvement.
● Transaction timeouts.
Operability
MySQL 8.0
● New transactional data dictionary.
● Atomic DDL operations.
● Persistent auto-increment values.
● Persistent configuration changes.
● Great foundation for future work, paying off tech debt.
Document Database Support
Postgres 9.6
● Added JSONB_INSERT()
Document Database Support
MySQL 8.0
● Added ->> operator for JSON
● Added JSON_ARRAYAGG() and JSON_OBJECTAGG()
● The “X Protocol” continues to be developed
● Improvements in MemcacheD protocol
Scalability and Scale-Out
Postgres 9.6
● Foreign Data Wrappers (FDW) are much more capable.
○ Allows UPDATE, DELETE
○ Allows JOIN, sorting
● Foundation for inter-server collaboration/coordination.
Scalability and Scale-Out
MySQL 8.0
● Group replication headed towards a top-level feature.
● Begins to introduce the notion of a “sharded replica set.”
NB: MongoDB is the clear leader over both MySQL and Postgres in “sharding” and “replica set” scale-out.
Other Notable Improvements
Postgres 9.6
● Improved full-text-search (FTS) support
○ Phrase, proximity, ordering
Other Notable Improvements
MySQL 8.0
● Common Table Expressions (CTEs)
● Both recursive and non-recursive
● No windowing functions yet
No More Wrong MagicMySQL 8.0 removes the ER_WRONG_MAGIC error.
Now you know.
Question & Answer & Upcoming
My contact info again - baron@vividcortex.com / @xaprb