SlideShare a Scribd company logo
1 of 62
Download to read offline
What’s wrong with
Postgres
Postgres is great
loved
wanted
DBMS
of the Year
Postgres is great, but it’s not perfect
loved
wanted
DBMS
of the Year
Who am I
Helped build and grow Heroku Postgres
Over 1.5 million databases across team of 8 individuals
Lead product and cloud teams at Citus
Currently running product for Azure Postgres
Write a lot about Postgres – craigkerstiens.com
Curate postgres weekly
@craigkerstiens on twitter
But first
Biggest mistake
Michael Fuhr <mike(at)fuhr(dot)org> writes:
> On Wed, Jul 12, 2006 at 07:39:05PM +0300, Petronenko D.S. wrote:
>> Can i get data in postgre from non-postgre db?
> The name is PostgreSQL or Postgres, not postgre.
It might help to explain that the pronunciation is "post-gres" or
"post-gres-cue-ell", not "post-gray-something".
I heard people making this same mistake in presentations at this
past weekend's Postgres Anniversary Conference :-( Arguably,
the 1996 decision to call it PostgreSQL instead of reverting to
plain Postgres was the single worst mistake this project ever made.
It seems far too late to change now, though.
regards, tom lane
Biggest mistake
Michael Fuhr <mike(at)fuhr(dot)org> writes:
> On Wed, Jul 12, 2006 at 07:39:05PM +0300, Petronenko D.S. wrote:
>> Can i get data in postgre from non-postgre db?
> The name is PostgreSQL or Postgres, not postgre.
It might help to explain that the pronunciation is "post-gres" or
"post-gres-cue-ell", not "post-gray-something".
I heard people making this same mistake in presentations at this
past weekend's Postgres Anniversary Conference :-( Arguably,
the 1996 decision to call it PostgreSQL instead of reverting to
plain Postgres was the single worst mistake this project ever made.
It seems far too late to change now, though.
regards, tom lane
What’s wrong with
Postgre
What’s wrong with Postgres
Getting
started
01
Getting to
production
02
Operating
at scale
03
The
community
04
Other areas
05
What’s wrong with Postgres
Getting
started
01
Getting to
production
02
Operating
at scale
03
The
community
04
Other areas
05
Documentation
Reference docs
On boarding
Tutorials/guides
Did you know Postgres
has a tutorial?
The tutorial
Before you can use PostgreSQL you need to install it, of course. It is possible
that PostgreSQL is already installed at your site, either because it was
included in your operating system distribution or because the system
administrator already installed it. If that is the case, you should obtain
information from the operating system documentation or your system
administrator about how to access PostgreSQL.
If you are not sure whether PostgreSQL is already available or whether you
can use it for your experimentation then you can install it yourself. Doing so
is not hard and it can be a good exercise. PostgreSQL can be installed by any
unprivileged user; no superuser (root) access is required.
The tutorial
Before you can use PostgreSQL you need to install it, of course. It is possible
that PostgreSQL is already installed at your site, either because it was
included in your operating system distribution or because the system
administrator already installed it. If that is the case, you should obtain
information from the operating system documentation or your system
administrator about how to access PostgreSQL.
If you are not sure whether PostgreSQL is already available or whether you
can use it for your experimentation then you can install it yourself. Doing so
is not hard and it can be a good exercise. PostgreSQL can be installed by any
unprivileged user; no superuser (root) access is required.
Go to chapter 16 to install
Installing for mac
Install from source?
• Okay, so installing is wrong, but we can get past that
• I return to google and it helps
What’s next
• Architecture fundamentals
• Creating a database
• Accessing the database
Accessing the database
Running the PostgreSQL interactive terminal program, called psql,
which allows you to interactively enter, edit, and execute SQL
commands.
Using an existing graphical frontend tool like pgAdmin or an office suite
with ODBC or JDBC support to create and manipulate a database.
These possibilities are not covered in this tutorial.
Writing a custom application, using one of the several available
language bindings. These possibilities are discussed further in Part IV.
Accessing the database
Running the PostgreSQL interactive terminal program, called psql,
which allows you to interactively enter, edit, and execute SQL
commands.
Using an existing graphical frontend tool like pgAdmin or an office suite
with ODBC or JDBC support to create and manipulate a database.
These possibilities are not covered in this tutorial.
Writing a custom application, using one of the several available
language bindings. These possibilities are discussed further in Part IV.
Libpq huh?
Accessing the database
Running the PostgreSQL interactive terminal program, called psql,
which allows you to interactively enter, edit, and execute SQL
commands.
Using an existing graphical frontend tool like pgAdmin or an office suite
with ODBC or JDBC support to create and manipulate a database.
These possibilities are not covered in this tutorial.
Writing a custom application, using one of the several available
language bindings. These possibilities are discussed further in Part IV.
Accessing the database
Running the PostgreSQL interactive terminal program, called psql,
which allows you to interactively enter, edit, and execute SQL
commands.
Using an existing graphical frontend tool like pgAdmin or an office suite
with ODBC or JDBC support to create and manipulate a database.
These possibilities are not covered in this tutorial.
Writing a custom application in C, using one of the several available
language bindings. These possibilities are discussed further in Part IV.
What if:
• Getting started with
• Ruby
• Ruby and Rails
• Ruby and Sequel
• Python
• Django
• Python and SQLAlchemy
• Java
• Node
• C
• Go
• PHP
• Perl
Django getting started
Install Postgres
pip install django psycopg2
django-admin.py startproject myproject .
~/myproject/myproject/settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'myproject',
'USER': 'myprojectuser',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '',
}
}
Documentation
Reference docs
On boarding
Tutorials/guides
How do I know what to look for
How do I know what to look for
How do we fix
it?
Dedicated tutorial section Can we pattern match for
common searches?
Do we analyze our google traffic
to see where people land?
Ask if docs were helpful?
What’s wrong with Postgres
Getting
started
01
Getting to
production
02
Operating
at scale
03
The
community
04
Other areas
05
Some assembly
required
• Config
• High availability
• Recovery
Django Batteries included
Config
• Postgresql.conf – settings
• Pg_hba.conf – access
Postgresql.conf
• Logging
• Memory
• Checkpoints
• Planner
Logging
• If you have syslog use it
• People that have syslog know what it is
• If someone doesn’t know what syslog is, shouldn’t we give them
something useful?
Shared buffers
• Default of 128MB
• Below 2GB of memory:
• Set to 20%
• Below 32GB of memory:
• Set to 25%
• Above 32GB of memory:
• Set to 8GB
Do we ever want this?
This looks like an if statement to me
Can we have machine learning for this?
Work_mem
• Start low at 32-64 MB
• Look for ‘temporary file’
• Then raise it
• If you raise it too high look for OOMs
• Then lower
Can we have machine learning for this?
But there are tools
• https://postgresqlco.nf/en/doc/param/
• https://pgtune.leopard.in.ua/#/
• https://github.com/jfcoz/postgresqltuner
And guides
• https://thebuild.com/presentations/not-your-job-pgconf-us-2017.pdf
It’s up and running, ready for production!
I want availability
• Read replica?
• Primary/stand-by
• Active/active
• Load balancer?
Primary/stand-by
• Patroni
• PAF
• Repmgr
• Stolon
• Pg_auto_failover
Postgres
doesn’t have
HA
Recovery time still not
consistent
Backups Do we all agree we need
them?
Backups
• We give users pg_dump up to 100/500GB
• Do we give them something else beyond that?
• Same thing as HA, we don’t have a solution, we allow you to pick a
solution
Backups
• Postgres can know when it was last backed up
• Should we tell users when it hasn’t been?
What’s wrong with Postgres
Getting
started
01
Getting to
production
02
Operating
at scale
03
The
community
04
Other areas
05
Vacuum
Connections
1. Establishing a connection
2. Connection overhead
3. The ceiling is too low
Establishing a connection
• Many databases running in cloud
• Want to securely communicate
• SSL or TLS negotiation aren’t free
• 10-100ms to get a new connection
Connection overhead
• Every connection consumes 10MB of overhead
• Applications grab a “pool” of connections
• Developers: I need 4,000 connections
• Me: I see 4 active queries and 3996 idle queries
Low ceiling
• So we need to handle idle connection with a
pooler
• Web apps start small, can scale massively,
even the average app you haven’t heard of,
can need over 1,000 connections
What’s wrong with Postgres
Getting
started
01
Getting to
production
02
Operating
at scale
03
The
community
04
Other areas
05
The project
• Businesses are betting on Postgres
• But businesses have certain expectations
Roadmap
• When is the next release happening
• Can we commit before we commit?
• Roadmaps don’t have to be feature
checklists, they can be directional
Funding source
• What is needed
What’s wrong with Postgres
Getting
started
01
Getting to
production
02
Operating
at scale
03
The
community
04
Other areas
05
JSON
• JSONB vs. JSON
• Could these be one?
• JSON users just want to insert data, they don’t want to even create a
table
Extensions
• What can’t they do:
• Change the grammar
• We still have a lot of missing hooks
Extensions
• How do I discover them?
• How do I vet them?
• How do I install them?
• Right now only a power user feature
What’s wrong with Postgre
Getting
started
01
Getting to
production
02
Operating
at scale
03
The
community
04
Other areas
05
Thanks!

More Related Content

What's hot

Designing your SaaS Database for Scale with Postgres
Designing your SaaS Database for Scale with PostgresDesigning your SaaS Database for Scale with Postgres
Designing your SaaS Database for Scale with Postgres
Ozgun Erdogan
 
Spark Tuning For Enterprise System Administrators, Spark Summit East 2016
Spark Tuning For Enterprise System Administrators, Spark Summit East 2016Spark Tuning For Enterprise System Administrators, Spark Summit East 2016
Spark Tuning For Enterprise System Administrators, Spark Summit East 2016
Anya Bida
 

What's hot (20)

How a Small Team Scales Instagram
How a Small Team Scales InstagramHow a Small Team Scales Instagram
How a Small Team Scales Instagram
 
Gophers Riding Elephants: Writing PostgreSQL tools in Go
Gophers Riding Elephants: Writing PostgreSQL tools in GoGophers Riding Elephants: Writing PostgreSQL tools in Go
Gophers Riding Elephants: Writing PostgreSQL tools in Go
 
Apache Gobblin: Bridging Batch and Streaming Data Integration. Big Data Meetu...
Apache Gobblin: Bridging Batch and Streaming Data Integration. Big Data Meetu...Apache Gobblin: Bridging Batch and Streaming Data Integration. Big Data Meetu...
Apache Gobblin: Bridging Batch and Streaming Data Integration. Big Data Meetu...
 
Internet scaleservice
Internet scaleserviceInternet scaleservice
Internet scaleservice
 
Open Source LinkedIn Analytics Pipeline - BOSS 2016 (VLDB)
Open Source LinkedIn Analytics Pipeline - BOSS 2016 (VLDB)Open Source LinkedIn Analytics Pipeline - BOSS 2016 (VLDB)
Open Source LinkedIn Analytics Pipeline - BOSS 2016 (VLDB)
 
Designing your SaaS Database for Scale with Postgres
Designing your SaaS Database for Scale with PostgresDesigning your SaaS Database for Scale with Postgres
Designing your SaaS Database for Scale with Postgres
 
Scaling Twitter
Scaling TwitterScaling Twitter
Scaling Twitter
 
Flintrock: A Faster, Better spark-ec2 by Nicholas Chammas
Flintrock: A Faster, Better spark-ec2 by Nicholas ChammasFlintrock: A Faster, Better spark-ec2 by Nicholas Chammas
Flintrock: A Faster, Better spark-ec2 by Nicholas Chammas
 
SQL for Everything at CWT2014
SQL for Everything at CWT2014SQL for Everything at CWT2014
SQL for Everything at CWT2014
 
3.3. Database honeypot
3.3. Database honeypot3.3. Database honeypot
3.3. Database honeypot
 
Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理
 
data.table and H2O at LondonR with Matt Dowle
data.table and H2O at LondonR with Matt Dowledata.table and H2O at LondonR with Matt Dowle
data.table and H2O at LondonR with Matt Dowle
 
How to create Treasure Data #dotsbigdata
How to create Treasure Data #dotsbigdataHow to create Treasure Data #dotsbigdata
How to create Treasure Data #dotsbigdata
 
Amazon RDS for PostgreSQL - PGConf 2016
Amazon RDS for PostgreSQL - PGConf 2016 Amazon RDS for PostgreSQL - PGConf 2016
Amazon RDS for PostgreSQL - PGConf 2016
 
Using Spark ML on Spark Errors - What do the clusters tell us?
Using Spark ML on Spark Errors - What do the clusters tell us?Using Spark ML on Spark Errors - What do the clusters tell us?
Using Spark ML on Spark Errors - What do the clusters tell us?
 
Spark Autotuning Talk - Strata New York
Spark Autotuning Talk - Strata New YorkSpark Autotuning Talk - Strata New York
Spark Autotuning Talk - Strata New York
 
Parallelizing Existing R Packages with SparkR
Parallelizing Existing R Packages with SparkRParallelizing Existing R Packages with SparkR
Parallelizing Existing R Packages with SparkR
 
Tuning Solr & Pipeline for Logs
Tuning Solr & Pipeline for LogsTuning Solr & Pipeline for Logs
Tuning Solr & Pipeline for Logs
 
Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017
Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017
Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017
 
Spark Tuning For Enterprise System Administrators, Spark Summit East 2016
Spark Tuning For Enterprise System Administrators, Spark Summit East 2016Spark Tuning For Enterprise System Administrators, Spark Summit East 2016
Spark Tuning For Enterprise System Administrators, Spark Summit East 2016
 

Similar to Whats wrong with postgres | PGConf EU 2019 | Craig Kerstiens

PostgreSQL_ Up and Running_ A Practical Guide to the Advanced Open Source Dat...
PostgreSQL_ Up and Running_ A Practical Guide to the Advanced Open Source Dat...PostgreSQL_ Up and Running_ A Practical Guide to the Advanced Open Source Dat...
PostgreSQL_ Up and Running_ A Practical Guide to the Advanced Open Source Dat...
MinhLeNguyenAnh2
 
Extensions on PostgreSQL
Extensions on PostgreSQLExtensions on PostgreSQL
Extensions on PostgreSQL
Alpaca
 
Work Queues
Work QueuesWork Queues
Work Queues
ciconf
 

Similar to Whats wrong with postgres | PGConf EU 2019 | Craig Kerstiens (20)

Drupal meets PostgreSQL for DrupalCamp MSK 2014
Drupal meets PostgreSQL for DrupalCamp MSK 2014Drupal meets PostgreSQL for DrupalCamp MSK 2014
Drupal meets PostgreSQL for DrupalCamp MSK 2014
 
Useful PostgreSQL Extensions
Useful PostgreSQL ExtensionsUseful PostgreSQL Extensions
Useful PostgreSQL Extensions
 
How to contribute PostgreSQL
How to contribute PostgreSQLHow to contribute PostgreSQL
How to contribute PostgreSQL
 
PostgreSQL_ Up and Running_ A Practical Guide to the Advanced Open Source Dat...
PostgreSQL_ Up and Running_ A Practical Guide to the Advanced Open Source Dat...PostgreSQL_ Up and Running_ A Practical Guide to the Advanced Open Source Dat...
PostgreSQL_ Up and Running_ A Practical Guide to the Advanced Open Source Dat...
 
How to get started with Site Reliability Engineering
How to get started with Site Reliability EngineeringHow to get started with Site Reliability Engineering
How to get started with Site Reliability Engineering
 
Lessons PostgreSQL learned from commercial databases, and didn’t
Lessons PostgreSQL learned from commercial databases, and didn’tLessons PostgreSQL learned from commercial databases, and didn’t
Lessons PostgreSQL learned from commercial databases, and didn’t
 
Big data made easy with a Spark
Big data made easy with a SparkBig data made easy with a Spark
Big data made easy with a Spark
 
50 Ways To Love Your Project
50 Ways To Love Your Project50 Ways To Love Your Project
50 Ways To Love Your Project
 
How To Do Excel-Like Row Selection in jQuery DataTable?
How To Do Excel-Like Row Selection in jQuery DataTable?How To Do Excel-Like Row Selection in jQuery DataTable?
How To Do Excel-Like Row Selection in jQuery DataTable?
 
Introduce Django
Introduce DjangoIntroduce Django
Introduce Django
 
Docker all the way
Docker all the wayDocker all the way
Docker all the way
 
Extensions on PostgreSQL
Extensions on PostgreSQLExtensions on PostgreSQL
Extensions on PostgreSQL
 
Systems Monitoring with Prometheus (Devops Ireland April 2015)
Systems Monitoring with Prometheus (Devops Ireland April 2015)Systems Monitoring with Prometheus (Devops Ireland April 2015)
Systems Monitoring with Prometheus (Devops Ireland April 2015)
 
From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...
From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...
From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...
 
From a student to an apache committer practice of apache io tdb
From a student to an apache committer  practice of apache io tdbFrom a student to an apache committer  practice of apache io tdb
From a student to an apache committer practice of apache io tdb
 
Work Queues
Work QueuesWork Queues
Work Queues
 
The Past, Present, and Future of Hadoop at LinkedIn
The Past, Present, and Future of Hadoop at LinkedInThe Past, Present, and Future of Hadoop at LinkedIn
The Past, Present, and Future of Hadoop at LinkedIn
 
etcd based PostgreSQL HA Cluster
etcd based PostgreSQL HA Clusteretcd based PostgreSQL HA Cluster
etcd based PostgreSQL HA Cluster
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp North
 
3 Easy Steps to Install Docker PostgreSQL Environment.pdf
3 Easy Steps to Install Docker PostgreSQL Environment.pdf3 Easy Steps to Install Docker PostgreSQL Environment.pdf
3 Easy Steps to Install Docker PostgreSQL Environment.pdf
 

More from Citus Data

Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...
Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...
Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...
Citus Data
 
Data Modeling, Normalization, and Denormalisation | FOSDEM '19 | Dimitri Font...
Data Modeling, Normalization, and Denormalisation | FOSDEM '19 | Dimitri Font...Data Modeling, Normalization, and Denormalisation | FOSDEM '19 | Dimitri Font...
Data Modeling, Normalization, and Denormalisation | FOSDEM '19 | Dimitri Font...
Citus Data
 

More from Citus Data (20)

Architecting peta-byte-scale analytics by scaling out Postgres on Azure with ...
Architecting peta-byte-scale analytics by scaling out Postgres on Azure with ...Architecting peta-byte-scale analytics by scaling out Postgres on Azure with ...
Architecting peta-byte-scale analytics by scaling out Postgres on Azure with ...
 
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
 
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
 
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
 
Amazing SQL your ORM can (or can't) do | PGConf EU 2019 | Louise Grandjonc
Amazing SQL your ORM can (or can't) do | PGConf EU 2019 | Louise GrandjoncAmazing SQL your ORM can (or can't) do | PGConf EU 2019 | Louise Grandjonc
Amazing SQL your ORM can (or can't) do | PGConf EU 2019 | Louise Grandjonc
 
What Microsoft is doing with Postgres & the Citus Data acquisition | PGConf E...
What Microsoft is doing with Postgres & the Citus Data acquisition | PGConf E...What Microsoft is doing with Postgres & the Citus Data acquisition | PGConf E...
What Microsoft is doing with Postgres & the Citus Data acquisition | PGConf E...
 
Deep Postgres Extensions in Rust | PGCon 2019 | Jeff Davis
Deep Postgres Extensions in Rust | PGCon 2019 | Jeff DavisDeep Postgres Extensions in Rust | PGCon 2019 | Jeff Davis
Deep Postgres Extensions in Rust | PGCon 2019 | Jeff Davis
 
Why Postgres Why This Database Why Now | SF Bay Area Postgres Meetup | Claire...
Why Postgres Why This Database Why Now | SF Bay Area Postgres Meetup | Claire...Why Postgres Why This Database Why Now | SF Bay Area Postgres Meetup | Claire...
Why Postgres Why This Database Why Now | SF Bay Area Postgres Meetup | Claire...
 
A story on Postgres index types | PostgresLondon 2019 | Louise Grandjonc
A story on Postgres index types | PostgresLondon 2019 | Louise GrandjoncA story on Postgres index types | PostgresLondon 2019 | Louise Grandjonc
A story on Postgres index types | PostgresLondon 2019 | Louise Grandjonc
 
Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...
Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...
Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...
 
The Art of PostgreSQL | PostgreSQL Ukraine | Dimitri Fontaine
The Art of PostgreSQL | PostgreSQL Ukraine | Dimitri FontaineThe Art of PostgreSQL | PostgreSQL Ukraine | Dimitri Fontaine
The Art of PostgreSQL | PostgreSQL Ukraine | Dimitri Fontaine
 
Optimizing your app by understanding your Postgres | RailsConf 2019 | Samay S...
Optimizing your app by understanding your Postgres | RailsConf 2019 | Samay S...Optimizing your app by understanding your Postgres | RailsConf 2019 | Samay S...
Optimizing your app by understanding your Postgres | RailsConf 2019 | Samay S...
 
The Art of PostgreSQL | PostgreSQL Ukraine Meetup | Dimitri Fontaine
The Art of PostgreSQL | PostgreSQL Ukraine Meetup | Dimitri FontaineThe Art of PostgreSQL | PostgreSQL Ukraine Meetup | Dimitri Fontaine
The Art of PostgreSQL | PostgreSQL Ukraine Meetup | Dimitri Fontaine
 
Using Postgres and Citus for Lightning Fast Analytics, also ft. Rollups | Liv...
Using Postgres and Citus for Lightning Fast Analytics, also ft. Rollups | Liv...Using Postgres and Citus for Lightning Fast Analytics, also ft. Rollups | Liv...
Using Postgres and Citus for Lightning Fast Analytics, also ft. Rollups | Liv...
 
How to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
How to write SQL queries | pgDay Paris 2019 | Dimitri FontaineHow to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
How to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
 
When it all Goes Wrong |Nordic PGDay 2019 | Will Leinweber
When it all Goes Wrong |Nordic PGDay 2019 | Will LeinweberWhen it all Goes Wrong |Nordic PGDay 2019 | Will Leinweber
When it all Goes Wrong |Nordic PGDay 2019 | Will Leinweber
 
Why PostgreSQL Why This Database Why Now | Nordic PGDay 2019 | Claire Giordano
Why PostgreSQL Why This Database Why Now | Nordic PGDay 2019 | Claire GiordanoWhy PostgreSQL Why This Database Why Now | Nordic PGDay 2019 | Claire Giordano
Why PostgreSQL Why This Database Why Now | Nordic PGDay 2019 | Claire Giordano
 
Scaling Multi-Tenant Applications Using the Django ORM & Postgres | PyCaribbe...
Scaling Multi-Tenant Applications Using the Django ORM & Postgres | PyCaribbe...Scaling Multi-Tenant Applications Using the Django ORM & Postgres | PyCaribbe...
Scaling Multi-Tenant Applications Using the Django ORM & Postgres | PyCaribbe...
 
Data Modeling, Normalization, and Denormalisation | FOSDEM '19 | Dimitri Font...
Data Modeling, Normalization, and Denormalisation | FOSDEM '19 | Dimitri Font...Data Modeling, Normalization, and Denormalisation | FOSDEM '19 | Dimitri Font...
Data Modeling, Normalization, and Denormalisation | FOSDEM '19 | Dimitri Font...
 
Five data models for sharding and which is right | PGConf.ASIA 2018 | Craig K...
Five data models for sharding and which is right | PGConf.ASIA 2018 | Craig K...Five data models for sharding and which is right | PGConf.ASIA 2018 | Craig K...
Five data models for sharding and which is right | PGConf.ASIA 2018 | Craig K...
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Whats wrong with postgres | PGConf EU 2019 | Craig Kerstiens

  • 3. Postgres is great, but it’s not perfect loved wanted DBMS of the Year
  • 4. Who am I Helped build and grow Heroku Postgres Over 1.5 million databases across team of 8 individuals Lead product and cloud teams at Citus Currently running product for Azure Postgres Write a lot about Postgres – craigkerstiens.com Curate postgres weekly @craigkerstiens on twitter
  • 6. Biggest mistake Michael Fuhr <mike(at)fuhr(dot)org> writes: > On Wed, Jul 12, 2006 at 07:39:05PM +0300, Petronenko D.S. wrote: >> Can i get data in postgre from non-postgre db? > The name is PostgreSQL or Postgres, not postgre. It might help to explain that the pronunciation is "post-gres" or "post-gres-cue-ell", not "post-gray-something". I heard people making this same mistake in presentations at this past weekend's Postgres Anniversary Conference :-( Arguably, the 1996 decision to call it PostgreSQL instead of reverting to plain Postgres was the single worst mistake this project ever made. It seems far too late to change now, though. regards, tom lane
  • 7. Biggest mistake Michael Fuhr <mike(at)fuhr(dot)org> writes: > On Wed, Jul 12, 2006 at 07:39:05PM +0300, Petronenko D.S. wrote: >> Can i get data in postgre from non-postgre db? > The name is PostgreSQL or Postgres, not postgre. It might help to explain that the pronunciation is "post-gres" or "post-gres-cue-ell", not "post-gray-something". I heard people making this same mistake in presentations at this past weekend's Postgres Anniversary Conference :-( Arguably, the 1996 decision to call it PostgreSQL instead of reverting to plain Postgres was the single worst mistake this project ever made. It seems far too late to change now, though. regards, tom lane
  • 9. What’s wrong with Postgres Getting started 01 Getting to production 02 Operating at scale 03 The community 04 Other areas 05
  • 10. What’s wrong with Postgres Getting started 01 Getting to production 02 Operating at scale 03 The community 04 Other areas 05
  • 12. Did you know Postgres has a tutorial?
  • 13. The tutorial Before you can use PostgreSQL you need to install it, of course. It is possible that PostgreSQL is already installed at your site, either because it was included in your operating system distribution or because the system administrator already installed it. If that is the case, you should obtain information from the operating system documentation or your system administrator about how to access PostgreSQL. If you are not sure whether PostgreSQL is already available or whether you can use it for your experimentation then you can install it yourself. Doing so is not hard and it can be a good exercise. PostgreSQL can be installed by any unprivileged user; no superuser (root) access is required.
  • 14. The tutorial Before you can use PostgreSQL you need to install it, of course. It is possible that PostgreSQL is already installed at your site, either because it was included in your operating system distribution or because the system administrator already installed it. If that is the case, you should obtain information from the operating system documentation or your system administrator about how to access PostgreSQL. If you are not sure whether PostgreSQL is already available or whether you can use it for your experimentation then you can install it yourself. Doing so is not hard and it can be a good exercise. PostgreSQL can be installed by any unprivileged user; no superuser (root) access is required.
  • 15. Go to chapter 16 to install
  • 17. Install from source? • Okay, so installing is wrong, but we can get past that • I return to google and it helps
  • 18. What’s next • Architecture fundamentals • Creating a database • Accessing the database
  • 19. Accessing the database Running the PostgreSQL interactive terminal program, called psql, which allows you to interactively enter, edit, and execute SQL commands. Using an existing graphical frontend tool like pgAdmin or an office suite with ODBC or JDBC support to create and manipulate a database. These possibilities are not covered in this tutorial. Writing a custom application, using one of the several available language bindings. These possibilities are discussed further in Part IV.
  • 20. Accessing the database Running the PostgreSQL interactive terminal program, called psql, which allows you to interactively enter, edit, and execute SQL commands. Using an existing graphical frontend tool like pgAdmin or an office suite with ODBC or JDBC support to create and manipulate a database. These possibilities are not covered in this tutorial. Writing a custom application, using one of the several available language bindings. These possibilities are discussed further in Part IV.
  • 22. Accessing the database Running the PostgreSQL interactive terminal program, called psql, which allows you to interactively enter, edit, and execute SQL commands. Using an existing graphical frontend tool like pgAdmin or an office suite with ODBC or JDBC support to create and manipulate a database. These possibilities are not covered in this tutorial. Writing a custom application, using one of the several available language bindings. These possibilities are discussed further in Part IV.
  • 23. Accessing the database Running the PostgreSQL interactive terminal program, called psql, which allows you to interactively enter, edit, and execute SQL commands. Using an existing graphical frontend tool like pgAdmin or an office suite with ODBC or JDBC support to create and manipulate a database. These possibilities are not covered in this tutorial. Writing a custom application in C, using one of the several available language bindings. These possibilities are discussed further in Part IV.
  • 24. What if: • Getting started with • Ruby • Ruby and Rails • Ruby and Sequel • Python • Django • Python and SQLAlchemy • Java • Node • C • Go • PHP • Perl
  • 25. Django getting started Install Postgres pip install django psycopg2 django-admin.py startproject myproject . ~/myproject/myproject/settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'myproject', 'USER': 'myprojectuser', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': '', } }
  • 27. How do I know what to look for
  • 28. How do I know what to look for
  • 29. How do we fix it? Dedicated tutorial section Can we pattern match for common searches? Do we analyze our google traffic to see where people land? Ask if docs were helpful?
  • 30. What’s wrong with Postgres Getting started 01 Getting to production 02 Operating at scale 03 The community 04 Other areas 05
  • 31. Some assembly required • Config • High availability • Recovery
  • 33. Config • Postgresql.conf – settings • Pg_hba.conf – access
  • 35. Logging • If you have syslog use it • People that have syslog know what it is • If someone doesn’t know what syslog is, shouldn’t we give them something useful?
  • 36. Shared buffers • Default of 128MB • Below 2GB of memory: • Set to 20% • Below 32GB of memory: • Set to 25% • Above 32GB of memory: • Set to 8GB Do we ever want this? This looks like an if statement to me Can we have machine learning for this?
  • 37. Work_mem • Start low at 32-64 MB • Look for ‘temporary file’ • Then raise it • If you raise it too high look for OOMs • Then lower Can we have machine learning for this?
  • 38. But there are tools • https://postgresqlco.nf/en/doc/param/ • https://pgtune.leopard.in.ua/#/ • https://github.com/jfcoz/postgresqltuner And guides • https://thebuild.com/presentations/not-your-job-pgconf-us-2017.pdf
  • 39. It’s up and running, ready for production!
  • 40. I want availability • Read replica? • Primary/stand-by • Active/active • Load balancer?
  • 41. Primary/stand-by • Patroni • PAF • Repmgr • Stolon • Pg_auto_failover
  • 43. Recovery time still not consistent
  • 44. Backups Do we all agree we need them?
  • 45. Backups • We give users pg_dump up to 100/500GB • Do we give them something else beyond that? • Same thing as HA, we don’t have a solution, we allow you to pick a solution
  • 46. Backups • Postgres can know when it was last backed up • Should we tell users when it hasn’t been?
  • 47. What’s wrong with Postgres Getting started 01 Getting to production 02 Operating at scale 03 The community 04 Other areas 05
  • 49. Connections 1. Establishing a connection 2. Connection overhead 3. The ceiling is too low
  • 50. Establishing a connection • Many databases running in cloud • Want to securely communicate • SSL or TLS negotiation aren’t free • 10-100ms to get a new connection
  • 51. Connection overhead • Every connection consumes 10MB of overhead • Applications grab a “pool” of connections • Developers: I need 4,000 connections • Me: I see 4 active queries and 3996 idle queries
  • 52. Low ceiling • So we need to handle idle connection with a pooler • Web apps start small, can scale massively, even the average app you haven’t heard of, can need over 1,000 connections
  • 53. What’s wrong with Postgres Getting started 01 Getting to production 02 Operating at scale 03 The community 04 Other areas 05
  • 54. The project • Businesses are betting on Postgres • But businesses have certain expectations
  • 55.
  • 56. Roadmap • When is the next release happening • Can we commit before we commit? • Roadmaps don’t have to be feature checklists, they can be directional
  • 58. What’s wrong with Postgres Getting started 01 Getting to production 02 Operating at scale 03 The community 04 Other areas 05
  • 59. JSON • JSONB vs. JSON • Could these be one? • JSON users just want to insert data, they don’t want to even create a table
  • 60. Extensions • What can’t they do: • Change the grammar • We still have a lot of missing hooks
  • 61. Extensions • How do I discover them? • How do I vet them? • How do I install them? • Right now only a power user feature
  • 62. What’s wrong with Postgre Getting started 01 Getting to production 02 Operating at scale 03 The community 04 Other areas 05 Thanks!