PostgreSQL 9.4 and Beyond @ FOSSASIA 2015 Singapore
1. PostgreSQL 9.4 and Beyond
JSON, Analytics, and More
Uptime Technologies
Satoshi Nagayasu
@snaga
FOSSASIA 2015
2. Satoshi Nagayasu
• Satoshi Nagayasu
– Database enthusiast. DBA and Data Steward.
– Traveling Asia: Hong Kong, Shenzhen, Beijing, Singapore
• Uptime Technologies
– Co-founder
– Providing consulting services around Database and Platform
Technologies.
• PostgreSQL
– pgstatindex, pageinspect, xlogdump
– PostgresForest, Postgres-XC (clusters)
– Organizing Japanese Users Group.
3. What Iʼm doing on
PostgreSQL
• Postgres Toolkit
– Brand new PostgreSQL DBA tool
– Stay informed at uptime.jp/go/pt
• Postgres Add-on for Hinemos
– One of the most popular system management tools
in Japan.
– Monitoring, Alerting, Job Management, etc.
16. NoSQL - JSONB
• “Binary JSON”
– Different from JSON, a text representation
– Faster for searching
• With JSONB...
– No duplicated keys allowed. Last wins.
– Key order not preserved.
– Can take advantages of GIN Index.
17. NoSQL - GIN Index
• JSON+btree vs. JSONB+GIN
– Btree indexes vs. GIN index
http://www.slideshare.net/toshiharada/jpug-studyjsonbdatatype20141011-40103981
Table Index Size Comparison
25. Replication and Beyond –
Logical Decoding
• “Logical” representation from replication stream
– INSERT/UPDATE/DELETE operations
– Can be replayed on different version/platform
• pg_recvlogical command
– Shows how it works
• Replication can be more flexible
– BDR (Bi-Directional Rep.), Slony, and more ...
– Continuous Backup as well
28. Administration - ALTER
SYSTEM
• ALTER SYSTEM SET
– puts new value in postgresql.auto.conf
– pg_reload_conf() reloads them.
– postgresql.auto.conf takes priority over
postgresql.conf.
• ALTER SYSTEM RESET
– Remove values from postgresql.auto.conf.
30. Dynamic Background
Workers
• In 9.3, background workers must start at the
postmaster startup.
• After 9.4, they can be launched “on-demand”
basis.
• From parallelization point of view...
– It allows to launch multiple background
processes to execute child queries in parallel.
31. Dynamic Shared Memory
• Shared memory can be allocated “on-demand”
basis
– Cf.) by background workers
• Main segment (ex. shared_buffers) still fixed at
startup
• Also supports lightweight message queue
• From parallelization point of view...
– It allows to share data and communicate with
several bgworker processes.
36. BRIN Index
• Block Range INdex
– Holds "summary“ data, instead of raw data.
– Reduces index size tremendously.
– Also reduces creation/maintenance cost.
– Needs extra tuple fetch to get the exact record.
0
50,000
100,000
150,000
200,000
250,000
300,000
Btree BRIN
Elapsed time (ms)
Index Creation
0
50,000
100,000
150,000
200,000
250,000
300,000
Btree BRIN
Number of Blocks
Index Size
0
2
4
6
8
10
12
14
16
18
Btree BRIN
Elapsed time (ms)
Select 1 record
https://gist.github.com/snaga/82173bd49749ccf0fa6c
37.
38. Commitfest 2015-2
CommitFest is a process to review, fix and
commit the submitted patches.
• Parallel Seq Scan
• INSERT ... ON CONFLICT {UPDATE | IGNORE}
• File level incremental backup
• and others..
Still work in progress...
commitfest.postgresql.org
39. Wrap-up
• One of the most developer-friendly
RDBMSes in the world.
• Analytics features and the performance
are improving.
• Things are going to parallel.