SlideShare a Scribd company logo
Welcome Parallelism to
PostgreSQL
Thursday, 19 May 2016
• Current State of Parallelism in PostgreSQL
• What was needed to bring server side parallelism – Work done in
v9.4 and v9.5
• Parallel Query in v9.6
• Review some parallel plans
• Parallelism may not be used always
• Parallelism may not be useful always
• Parameters
• Benefits
• Questions
Agenda
2
• Client side parallelism – Application can open multiple sessions
• One can run a batch with multiple application threads
• Server side languages can potentially do parallel operations
• I/O activity is taken off from main query execution process by wal
writer and bgwriter
• effective_io_concurrency allows page prefetch requests to the
kernel, for bitmap joins
• But there is no server side parallelism for dividing the same task
among multiple-workers
Current State (v9.5) of Parallelism in PostgreSQL
3
v9.4
• Dynamic background workers
• Dynamic shared memory
• Implementation of shared
memory message queues
v9.5
• Message propagation i.e. error
messages from background
worker can be sent to master
and received by master
• Synchronization of state (GUC
values, XID, CID mapping,
current user and current db
etc)
• Parallel Contexts can be used
by backend code to launch
worker processes
A lot of work was needed and was done!
4
• Parallel Sequential Scan
• Parallel Joins
• Parallel Aggregates
• Though these are not in their best forms and have certain
exceptions/limitations but they still work and quite useful!
v9.6: We have something that users can use!
5
Basically how parallelism is supposed to work
6
Let’s look at some plans
Sequential Scan without Parallelism
8
Parallel Sequential Scans
9
You may not get as many workers as you desire
10
Parallel Aggregate
11
Parallel Joins
12
Wow! So using ‘Parallel
Workers’ should be
preferred!
No, not really!
Parallel Query May not be used all the time
• Cost of working and coordinating among multiple worker
processes defeats the advantage of parallelism
• Cost of setting up parallelism infrastructure is too high
• No worker process is available
14
Example
15
Parallel Query may not be good all the time
16
Parallel Query may not be good all the time
• It depends a lot on your hardware resources and process scheduling by
your OS
• I tried various degree of parallelism on a test machine
• 3 CPU, 3GB RAM
• VM Running CentOS
• Single I/O disk
• A simple ‘count’ on a table with 100million rows and 8 byte width
• explain analyze select count(*) from pgbench_accounts ;
• It performs faster with parallel degree set to 0, as index scan is
performed
• Make sure you have tuned your parameters well to help optimizer
decide
17
Parameters Involved
Parameters which govern parallel query execution
• parallel_setup_cost
• parallel_tuple_cost
• max_worker_processes
• max_parallel_degree
• force_parallel_mode
• ALTER TABLE … SET (parallel_degree=n)
• ALTER FUNCTION … PARALLEL SAFE
• ALTER FUNCTION … COST
19
Benefits to the users
• Sequential scan on large tables would be faster
• Analytics workload involve aggregates would be faster
• Faster JOINs between large tables
• PostgreSQL v9.6 can be a good candidate for the backend
database of data warehouse
• More parallel operations to come in future releases
20
What can you do?
• PostgreSQL Beta 1 is out
• Try it out…
• Test it…
• Break it…
• Report it
• Help PostgreSQL community make it better
21
Further Reading
• PGCon 2014: Implementing Parallelism in PostgreSQL, Robert
Haas
• PGConf.US, 2016: PostgreSQL 9.6, Magnus Hagander
• PGCon, Ottawa 2015: Parallel Sequential Scan, Robert Haas and
Amit Kapila at
• EnterpriseDB Blog: Parallelism Progress, Robert Haas
• Parallel Sequential Scan is Committed, Robert Haas
• EnterpriseDB Blog: Parallelism Becomes a Reality in Postgres, Amit
Kapila
22
Send us your suggestions and questions
success@ashnik.com
Stay Tuned!
Website: www.ashnik.com

More Related Content

What's hot (20)

PDF
hbaseconasia2017: HBase在Hulu的使用和实践
HBaseCon
 
PDF
hbaseconasia2017: Large scale data near-line loading method and architecture
HBaseCon
 
PDF
hbaseconasia2017: HBase Disaster Recovery Solution at Huawei
HBaseCon
 
PDF
Architecture for building scalable and highly available Postgres Cluster
Ashnikbiz
 
PDF
Streaming Replication (Keynote @ PostgreSQL Conference 2009 Japan)
Masao Fujii
 
PDF
25 snowflake
剑飞 陈
 
PDF
HBaseCon2017 Removable singularity: a story of HBase upgrade in Pinterest
HBaseCon
 
PDF
EDB Postgres DBA Best Practices
EDB
 
PDF
Security Best Practices for your Postgres Deployment
PGConf APAC
 
PPT
PostgreSQL9.3 Switchover/Switchback
Vibhor Kumar
 
PPTX
The Magic of Tuning in PostgreSQL
Ashnikbiz
 
PDF
Kafka to the Maxka - (Kafka Performance Tuning)
DataWorks Summit
 
PDF
MariaDB Performance Tuning and Optimization
MariaDB plc
 
PDF
Lessons PostgreSQL learned from commercial databases, and didn’t
PGConf APAC
 
PDF
hbaseconasia2017: Apache HBase at Netease
HBaseCon
 
PDF
hbaseconasia2017: hbase-2.0.0
HBaseCon
 
KEY
Writing Scalable Software in Java
Ruben Badaró
 
PDF
Application Caching: The Hidden Microservice
Scott Mansfield
 
PPTX
Hardware planning & sizing for sql server
Davide Mauri
 
PDF
Postgres-XC: Symmetric PostgreSQL Cluster
Pavan Deolasee
 
hbaseconasia2017: HBase在Hulu的使用和实践
HBaseCon
 
hbaseconasia2017: Large scale data near-line loading method and architecture
HBaseCon
 
hbaseconasia2017: HBase Disaster Recovery Solution at Huawei
HBaseCon
 
Architecture for building scalable and highly available Postgres Cluster
Ashnikbiz
 
Streaming Replication (Keynote @ PostgreSQL Conference 2009 Japan)
Masao Fujii
 
25 snowflake
剑飞 陈
 
HBaseCon2017 Removable singularity: a story of HBase upgrade in Pinterest
HBaseCon
 
EDB Postgres DBA Best Practices
EDB
 
Security Best Practices for your Postgres Deployment
PGConf APAC
 
PostgreSQL9.3 Switchover/Switchback
Vibhor Kumar
 
The Magic of Tuning in PostgreSQL
Ashnikbiz
 
Kafka to the Maxka - (Kafka Performance Tuning)
DataWorks Summit
 
MariaDB Performance Tuning and Optimization
MariaDB plc
 
Lessons PostgreSQL learned from commercial databases, and didn’t
PGConf APAC
 
hbaseconasia2017: Apache HBase at Netease
HBaseCon
 
hbaseconasia2017: hbase-2.0.0
HBaseCon
 
Writing Scalable Software in Java
Ruben Badaró
 
Application Caching: The Hidden Microservice
Scott Mansfield
 
Hardware planning & sizing for sql server
Davide Mauri
 
Postgres-XC: Symmetric PostgreSQL Cluster
Pavan Deolasee
 

Viewers also liked (18)

PPTX
Tuning Slow Running SQLs in PostgreSQL
Ashnikbiz
 
PDF
FOSSASIA 2016 - 7 Tips to design web centric high-performance applications
Ashnikbiz
 
PPTX
NGINX Plus PLATFORM For Flawless Application Delivery
Ashnikbiz
 
PDF
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
Ashnikbiz
 
PPTX
Streaming replication in PostgreSQL
Ashnikbiz
 
PDF
Building Hybrid data cluster using PostgreSQL and MongoDB
Ashnikbiz
 
PPTX
Building Data Integration and Transformations using Pentaho
Ashnikbiz
 
PDF
PgDay Asia 2016 - Security Best Practices for your Postgres Deployment
Ashnikbiz
 
PDF
What's New in PostgreSQL 9.3
EDB
 
PDF
EnterpriseDB BackUp and Recovery Tool
EDB
 
PDF
DBaaS with EDB Postgres on AWS
EDB
 
PPTX
Big Data Business Transformation - Big Picture and Blueprints
Ashnikbiz
 
PDF
5 Postgres DBA Tips
EDB
 
PDF
What's New in PostgreSQL 9.6
EDB
 
PDF
Useful PostgreSQL Extensions
EDB
 
PDF
(Ab)using 4d Indexing
PGConf APAC
 
PDF
Big Data and PostgreSQL
PGConf APAC
 
PDF
Migration From Oracle to PostgreSQL
PGConf APAC
 
Tuning Slow Running SQLs in PostgreSQL
Ashnikbiz
 
FOSSASIA 2016 - 7 Tips to design web centric high-performance applications
Ashnikbiz
 
NGINX Plus PLATFORM For Flawless Application Delivery
Ashnikbiz
 
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
Ashnikbiz
 
Streaming replication in PostgreSQL
Ashnikbiz
 
Building Hybrid data cluster using PostgreSQL and MongoDB
Ashnikbiz
 
Building Data Integration and Transformations using Pentaho
Ashnikbiz
 
PgDay Asia 2016 - Security Best Practices for your Postgres Deployment
Ashnikbiz
 
What's New in PostgreSQL 9.3
EDB
 
EnterpriseDB BackUp and Recovery Tool
EDB
 
DBaaS with EDB Postgres on AWS
EDB
 
Big Data Business Transformation - Big Picture and Blueprints
Ashnikbiz
 
5 Postgres DBA Tips
EDB
 
What's New in PostgreSQL 9.6
EDB
 
Useful PostgreSQL Extensions
EDB
 
(Ab)using 4d Indexing
PGConf APAC
 
Big Data and PostgreSQL
PGConf APAC
 
Migration From Oracle to PostgreSQL
PGConf APAC
 
Ad

Similar to 2016 may-countdown-to-postgres-v96-parallel-query (20)

PPTX
IBM Maximo Performance Tuning
FMMUG
 
PPTX
MongoDB: How We Did It – Reanimating Identity at AOL
MongoDB
 
PPT
BIL406-Chapter-6-Basic Parallelism and CPU.ppt
Kadri20
 
PDF
071410 sun a_1515_feldman_stephen
Steve Feldman
 
PDF
Benchmarking Performance and Scalability with Web Stress
InterSystems Corporation
 
PPTX
Fastest Servlets in the West
Stuart (Pid) Williams
 
PDF
IMCSummit 2015 - Day 1 Developer Track - In-memory Computing for Iterative CP...
In-Memory Computing Summit
 
PDF
POLARDB for MySQL - Parallel Query
oysteing
 
PDF
(ATS6-PLAT06) Maximizing AEP Performance
BIOVIA
 
PDF
On-boarding with JanusGraph Performance
Chin Huang
 
PDF
Performance tuning Grails applications
Lari Hotari
 
PPTX
Rubyslava + PyVo #48
Jozef Képesi
 
PPTX
Performance Benchmarking: Tips, Tricks, and Lessons Learned
Tim Callaghan
 
PPT
Performance and Scalability Tuning
Andres March
 
PDF
Enabling presto to handle massive scale at lightning speed
Shubham Tagra
 
PPTX
Performance tuning Grails applications SpringOne 2GX 2014
Lari Hotari
 
PPTX
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
Apache Apex
 
PPTX
PREDIcT
Apurva Kulkarni
 
PPTX
Background processing with hangfire
Aleksandar Bozinovski
 
PPTX
Apache Big Data 2016: Next Gen Big Data Analytics with Apache Apex
Apache Apex
 
IBM Maximo Performance Tuning
FMMUG
 
MongoDB: How We Did It – Reanimating Identity at AOL
MongoDB
 
BIL406-Chapter-6-Basic Parallelism and CPU.ppt
Kadri20
 
071410 sun a_1515_feldman_stephen
Steve Feldman
 
Benchmarking Performance and Scalability with Web Stress
InterSystems Corporation
 
Fastest Servlets in the West
Stuart (Pid) Williams
 
IMCSummit 2015 - Day 1 Developer Track - In-memory Computing for Iterative CP...
In-Memory Computing Summit
 
POLARDB for MySQL - Parallel Query
oysteing
 
(ATS6-PLAT06) Maximizing AEP Performance
BIOVIA
 
On-boarding with JanusGraph Performance
Chin Huang
 
Performance tuning Grails applications
Lari Hotari
 
Rubyslava + PyVo #48
Jozef Képesi
 
Performance Benchmarking: Tips, Tricks, and Lessons Learned
Tim Callaghan
 
Performance and Scalability Tuning
Andres March
 
Enabling presto to handle massive scale at lightning speed
Shubham Tagra
 
Performance tuning Grails applications SpringOne 2GX 2014
Lari Hotari
 
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
Apache Apex
 
Background processing with hangfire
Aleksandar Bozinovski
 
Apache Big Data 2016: Next Gen Big Data Analytics with Apache Apex
Apache Apex
 
Ad

More from Ashnikbiz (20)

PPTX
CloudOps_tool.pptx
Ashnikbiz
 
PPTX
Webinar_CloudOps final.pptx
Ashnikbiz
 
PPTX
Autoscaling in Kubernetes (K8s)
Ashnikbiz
 
PPTX
Why and how to use Kubernetes for scaling of your multi-tier (n-tier) appli...
Ashnikbiz
 
PDF
Zero trust in a multi tenant environment
Ashnikbiz
 
PPTX
Deploy and automate ‘Secrets Management’ for a multi-cloud environment
Ashnikbiz
 
PPTX
Deploy, move and manage Postgres across cloud platforms
Ashnikbiz
 
PPTX
Deploy, move and manage Postgres across cloud platforms
Ashnikbiz
 
PPTX
The Best Approach For Multi-cloud Infrastructure Provisioning-2
Ashnikbiz
 
PPTX
The Best Approach For Multi-cloud Infrastructure Provisioning
Ashnikbiz
 
PPTX
Which PostgreSQL is right for your multi cloud strategy? P2
Ashnikbiz
 
PPTX
Which PostgreSQL is right for your multi cloud strategy? P1
Ashnikbiz
 
PPTX
Reduce the complexities of managing Kubernetes clusters anywhere 2
Ashnikbiz
 
PPTX
Reduce the complexities of managing Kubernetes clusters anywhere
Ashnikbiz
 
PPTX
Enhance your multi-cloud application performance using Redis Enterprise P2
Ashnikbiz
 
PPTX
Enhance your multi-cloud application performance using Redis Enterprise P1
Ashnikbiz
 
PPTX
Gain multi-cloud versatility with software load balancing designed for cloud-...
Ashnikbiz
 
PPTX
Gain multi-cloud versatility with software load balancing designed for cloud-...
Ashnikbiz
 
PPTX
Enterprise-class security with PostgreSQL - 1
Ashnikbiz
 
PPTX
Enterprise-class security with PostgreSQL - 2
Ashnikbiz
 
CloudOps_tool.pptx
Ashnikbiz
 
Webinar_CloudOps final.pptx
Ashnikbiz
 
Autoscaling in Kubernetes (K8s)
Ashnikbiz
 
Why and how to use Kubernetes for scaling of your multi-tier (n-tier) appli...
Ashnikbiz
 
Zero trust in a multi tenant environment
Ashnikbiz
 
Deploy and automate ‘Secrets Management’ for a multi-cloud environment
Ashnikbiz
 
Deploy, move and manage Postgres across cloud platforms
Ashnikbiz
 
Deploy, move and manage Postgres across cloud platforms
Ashnikbiz
 
The Best Approach For Multi-cloud Infrastructure Provisioning-2
Ashnikbiz
 
The Best Approach For Multi-cloud Infrastructure Provisioning
Ashnikbiz
 
Which PostgreSQL is right for your multi cloud strategy? P2
Ashnikbiz
 
Which PostgreSQL is right for your multi cloud strategy? P1
Ashnikbiz
 
Reduce the complexities of managing Kubernetes clusters anywhere 2
Ashnikbiz
 
Reduce the complexities of managing Kubernetes clusters anywhere
Ashnikbiz
 
Enhance your multi-cloud application performance using Redis Enterprise P2
Ashnikbiz
 
Enhance your multi-cloud application performance using Redis Enterprise P1
Ashnikbiz
 
Gain multi-cloud versatility with software load balancing designed for cloud-...
Ashnikbiz
 
Gain multi-cloud versatility with software load balancing designed for cloud-...
Ashnikbiz
 
Enterprise-class security with PostgreSQL - 1
Ashnikbiz
 
Enterprise-class security with PostgreSQL - 2
Ashnikbiz
 

Recently uploaded (20)

PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PDF
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 

2016 may-countdown-to-postgres-v96-parallel-query

  • 2. • Current State of Parallelism in PostgreSQL • What was needed to bring server side parallelism – Work done in v9.4 and v9.5 • Parallel Query in v9.6 • Review some parallel plans • Parallelism may not be used always • Parallelism may not be useful always • Parameters • Benefits • Questions Agenda 2
  • 3. • Client side parallelism – Application can open multiple sessions • One can run a batch with multiple application threads • Server side languages can potentially do parallel operations • I/O activity is taken off from main query execution process by wal writer and bgwriter • effective_io_concurrency allows page prefetch requests to the kernel, for bitmap joins • But there is no server side parallelism for dividing the same task among multiple-workers Current State (v9.5) of Parallelism in PostgreSQL 3
  • 4. v9.4 • Dynamic background workers • Dynamic shared memory • Implementation of shared memory message queues v9.5 • Message propagation i.e. error messages from background worker can be sent to master and received by master • Synchronization of state (GUC values, XID, CID mapping, current user and current db etc) • Parallel Contexts can be used by backend code to launch worker processes A lot of work was needed and was done! 4
  • 5. • Parallel Sequential Scan • Parallel Joins • Parallel Aggregates • Though these are not in their best forms and have certain exceptions/limitations but they still work and quite useful! v9.6: We have something that users can use! 5
  • 6. Basically how parallelism is supposed to work 6
  • 7. Let’s look at some plans
  • 8. Sequential Scan without Parallelism 8
  • 10. You may not get as many workers as you desire 10
  • 13. Wow! So using ‘Parallel Workers’ should be preferred! No, not really!
  • 14. Parallel Query May not be used all the time • Cost of working and coordinating among multiple worker processes defeats the advantage of parallelism • Cost of setting up parallelism infrastructure is too high • No worker process is available 14
  • 16. Parallel Query may not be good all the time 16
  • 17. Parallel Query may not be good all the time • It depends a lot on your hardware resources and process scheduling by your OS • I tried various degree of parallelism on a test machine • 3 CPU, 3GB RAM • VM Running CentOS • Single I/O disk • A simple ‘count’ on a table with 100million rows and 8 byte width • explain analyze select count(*) from pgbench_accounts ; • It performs faster with parallel degree set to 0, as index scan is performed • Make sure you have tuned your parameters well to help optimizer decide 17
  • 19. Parameters which govern parallel query execution • parallel_setup_cost • parallel_tuple_cost • max_worker_processes • max_parallel_degree • force_parallel_mode • ALTER TABLE … SET (parallel_degree=n) • ALTER FUNCTION … PARALLEL SAFE • ALTER FUNCTION … COST 19
  • 20. Benefits to the users • Sequential scan on large tables would be faster • Analytics workload involve aggregates would be faster • Faster JOINs between large tables • PostgreSQL v9.6 can be a good candidate for the backend database of data warehouse • More parallel operations to come in future releases 20
  • 21. What can you do? • PostgreSQL Beta 1 is out • Try it out… • Test it… • Break it… • Report it • Help PostgreSQL community make it better 21
  • 22. Further Reading • PGCon 2014: Implementing Parallelism in PostgreSQL, Robert Haas • PGConf.US, 2016: PostgreSQL 9.6, Magnus Hagander • PGCon, Ottawa 2015: Parallel Sequential Scan, Robert Haas and Amit Kapila at • EnterpriseDB Blog: Parallelism Progress, Robert Haas • Parallel Sequential Scan is Committed, Robert Haas • EnterpriseDB Blog: Parallelism Becomes a Reality in Postgres, Amit Kapila 22
  • 23. Send us your suggestions and questions [email protected] Stay Tuned! Website: www.ashnik.com