SlideShare a Scribd company logo
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
Whats wrong with postgres | PGConf EU 2019 | Craig Kerstiens
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 (20)

PDF
How a Small Team Scales Instagram
C4Media
 
PDF
Gophers Riding Elephants: Writing PostgreSQL tools in Go
AJ Bahnken
 
PDF
Apache Gobblin: Bridging Batch and Streaming Data Integration. Big Data Meetu...
Shirshanka Das
 
PDF
Internet scaleservice
DaeMyung Kang
 
PPTX
Open Source LinkedIn Analytics Pipeline - BOSS 2016 (VLDB)
Issac Buenrostro
 
PDF
Designing your SaaS Database for Scale with Postgres
Ozgun Erdogan
 
PDF
Scaling Twitter
Blaine
 
PDF
Flintrock: A Faster, Better spark-ec2 by Nicholas Chammas
Spark Summit
 
PDF
SQL for Everything at CWT2014
N Masahiro
 
PDF
3.3. Database honeypot
defconmoscow
 
PDF
Digdagによる大規模データ処理の自動化とエラー処理
Sadayuki Furuhashi
 
PDF
data.table and H2O at LondonR with Matt Dowle
Sri Ambati
 
PDF
How to create Treasure Data #dotsbigdata
N Masahiro
 
PPTX
Amazon RDS for PostgreSQL - PGConf 2016
Grant McAlister
 
PDF
Using Spark ML on Spark Errors - What do the clusters tell us?
Holden Karau
 
PDF
Spark Autotuning Talk - Strata New York
Holden Karau
 
PPTX
Parallelizing Existing R Packages with SparkR
Databricks
 
PDF
Tuning Solr & Pipeline for Logs
Sematext Group, Inc.
 
PDF
Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017
Codemotion
 
PDF
Spark Tuning For Enterprise System Administrators, Spark Summit East 2016
Anya Bida
 
How a Small Team Scales Instagram
C4Media
 
Gophers Riding Elephants: Writing PostgreSQL tools in Go
AJ Bahnken
 
Apache Gobblin: Bridging Batch and Streaming Data Integration. Big Data Meetu...
Shirshanka Das
 
Internet scaleservice
DaeMyung Kang
 
Open Source LinkedIn Analytics Pipeline - BOSS 2016 (VLDB)
Issac Buenrostro
 
Designing your SaaS Database for Scale with Postgres
Ozgun Erdogan
 
Scaling Twitter
Blaine
 
Flintrock: A Faster, Better spark-ec2 by Nicholas Chammas
Spark Summit
 
SQL for Everything at CWT2014
N Masahiro
 
3.3. Database honeypot
defconmoscow
 
Digdagによる大規模データ処理の自動化とエラー処理
Sadayuki Furuhashi
 
data.table and H2O at LondonR with Matt Dowle
Sri Ambati
 
How to create Treasure Data #dotsbigdata
N Masahiro
 
Amazon RDS for PostgreSQL - PGConf 2016
Grant McAlister
 
Using Spark ML on Spark Errors - What do the clusters tell us?
Holden Karau
 
Spark Autotuning Talk - Strata New York
Holden Karau
 
Parallelizing Existing R Packages with SparkR
Databricks
 
Tuning Solr & Pipeline for Logs
Sematext Group, Inc.
 
Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017
Codemotion
 
Spark Tuning For Enterprise System Administrators, Spark Summit East 2016
Anya Bida
 

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

PPTX
Drupal meets PostgreSQL for DrupalCamp MSK 2014
Kate Marshalkina
 
PDF
Useful PostgreSQL Extensions
EDB
 
PDF
How to contribute PostgreSQL
Hari Babu kommi
 
PDF
PostgreSQL_ Up and Running_ A Practical Guide to the Advanced Open Source Dat...
MinhLeNguyenAnh2
 
PDF
How to get started with Site Reliability Engineering
Andrew Kirkpatrick
 
PDF
Lessons PostgreSQL learned from commercial databases, and didn’t
PGConf APAC
 
PDF
Big data made easy with a Spark
Jean-Georges Perrin
 
PDF
50 Ways To Love Your Project
PostgreSQL Experts, Inc.
 
PDF
How To Do Excel-Like Row Selection in jQuery DataTable?
Polyxer Systems
 
ODP
Introduce Django
Chui-Wen Chiu
 
PPTX
Docker all the way
Johan Vergeer
 
PDF
Extensions on PostgreSQL
Alpaca
 
PDF
Systems Monitoring with Prometheus (Devops Ireland April 2015)
Brian Brazil
 
PPTX
From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...
Alexander Dean
 
PDF
From a student to an apache committer practice of apache io tdb
jixuan1989
 
KEY
Work Queues
ciconf
 
PPTX
The Past, Present, and Future of Hadoop at LinkedIn
Carl Steinbach
 
PDF
etcd based PostgreSQL HA Cluster
winsletts
 
PDF
Drupal Performance : DrupalCamp North
Philip Norton
 
PDF
3 Easy Steps to Install Docker PostgreSQL Environment.pdf
calfonzodaly
 
Drupal meets PostgreSQL for DrupalCamp MSK 2014
Kate Marshalkina
 
Useful PostgreSQL Extensions
EDB
 
How to contribute PostgreSQL
Hari Babu kommi
 
PostgreSQL_ Up and Running_ A Practical Guide to the Advanced Open Source Dat...
MinhLeNguyenAnh2
 
How to get started with Site Reliability Engineering
Andrew Kirkpatrick
 
Lessons PostgreSQL learned from commercial databases, and didn’t
PGConf APAC
 
Big data made easy with a Spark
Jean-Georges Perrin
 
50 Ways To Love Your Project
PostgreSQL Experts, Inc.
 
How To Do Excel-Like Row Selection in jQuery DataTable?
Polyxer Systems
 
Introduce Django
Chui-Wen Chiu
 
Docker all the way
Johan Vergeer
 
Extensions on PostgreSQL
Alpaca
 
Systems Monitoring with Prometheus (Devops Ireland April 2015)
Brian Brazil
 
From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...
Alexander Dean
 
From a student to an apache committer practice of apache io tdb
jixuan1989
 
Work Queues
ciconf
 
The Past, Present, and Future of Hadoop at LinkedIn
Carl Steinbach
 
etcd based PostgreSQL HA Cluster
winsletts
 
Drupal Performance : DrupalCamp North
Philip Norton
 
3 Easy Steps to Install Docker PostgreSQL Environment.pdf
calfonzodaly
 
Ad

More from Citus Data (20)

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

Recently uploaded (20)

PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Digital Circuits, important subject in CS
contactparinay1
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 

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
  • 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!