SlideShare a Scribd company logo
7 ways
   to

crash
Postgres
                  Josh Berkus
           PostgreSQL Project
           LinuxConf.AU 2013
7 Ways To Crash Postgres
7 Ways To Crash Postgres
Don't
1   Apply
    Updates
1. ignore update
  announcements
2. keep running version X.X.0
  or X.X.1
3. wait for disaster to strike
9. 2. 2
9. 2. 3
7 Ways To Crash Postgres
9.2.2:
Prevent database-wide crash and
restart when a new child process
is unable to create a pipe for its
latch.

9.1.6:
Fix misbehavior when
default_transaction_isolation is
set to serializable. Symptoms
include crashes at process start
on Windows, and crashes in hot
standby operation.
Upgrade!

EOL after 5 years
8.3 is now EOL
Out of
2   Disk
    Space
1. install DB on volume which is
  80% full
2. don't monitor disk space
  usage
3. let database grow
ERROR: could not write
block 31840050 of
temporary file: No space
left on device


PANIC: could not write
to file
"pg_xlog/xlogtemp.49680"
: No space left on
device
Out of

2a   Disk Space
     Archiving
     Edition
1. set up transaction log
  archiving to a standby
2. stop file use/deletion on the
  standby
3. don't monitor
4. disk on the standby fills up
   with archive logs
5. disk on the master fills up
   with archive logs
6. failover impossible
freeing up space
takes more space
●   VACUUM FULL
●   REINDEX
●   DELETE
●   pg_reorg
DROP TABLE;
DROP DATABASE;
3   Deleting
    Stuff
base           pg_snapshots
cold           pg_stat_tmp
global         pg_subtrans
hot            pg_tblspc
pg_clog        pg_twophase
pg_hba.conf    PG_VERSION
pg_ident.conf  pg_xlog
pg_log         postgresql.conf
pg_multixact  
pg_notify      postmaster.opts
pg_serial
base           pg_snapshots
cold           pg_stat_tmp
global         pg_subtrans
hot            pg_tblspc
pg_clog        pg_twophase
pg_hba.conf    PG_VERSION
pg_ident.conf  pg_xlog
pg_log         postgresql.conf
pg_multixact  
pg_notify      postmaster.opts
pg_serial
2012-09-25 08:27:03 UTC
ERROR: could not access
status of transaction
500185903

2012-09-25 08:27:03 UTC
DETAIL: Could not open file
"pg_clog/01DD": No such file
or directory.
4   Out of
    Memory
1. set shared_buffers to
  80% of RAM
2. set work_mem to 1GB
3. ramp up to 1000
  connections
1. run Postgres on cloud server
2. add a JVM
3. add Apache/mod_php
4. add MySQL
5. add a second Postgres
  version
0. run server with default
   Linux memory management
   settings
kernel: postgres invoked
oom-killer: gfp_mask=0x201d2,
order=0, oomkilladj=0

LOG: background writer
process (PID 22999) was
terminated by signal 9:
Killed

LOG: terminating any other
active server processes
5   Bad
    Hardware
1. buy brand-new hardware
2. install PostgreSQL
3. don't test
4. deploy in production
1. deploy production hardware
2. don't monitor SMART
3. don't monitor syslog
4. run for a couple years
ERROR: could not read block
1 in file "base/18511/13872":
read only 0 of 8192 bytes

FATAL: failed to re-find
parent key in index
"257969064" for split pages
8366/12375
Too
6   Many
    Connections
1. build application with ad-hoc
  DB connections
2. no connection pooling
3. program auto-reconnect on
  timeout
4. raise max_connections to
  2000
CRITICAL: server postgres2 is
not accepting connections
7   Zombie
    Locks
1. program application so it
  forgets to close transactions
2. run for a few hours or days
3. watch the locks pile up
DBI ERROR timeout after
300 seconds: "UPDATE
sessions SET last_seen =
now()WHERE session_key =
'a16g32b12cd0';"
1.   no updates
2.   out of disk space
3.   deleting stuff
4.   out of RAM
5.   bad hardware
6.   too many connections
7.   zombie locks
7 Ways To Crash Postgres
more elephants
●       Postgres Pizza BOF:
    –    Wed Night, 8:30PM, B&G Snooker Hall
                                                                                       th
●
        pgDay Melbourne: Feb 5
    –   2013.pgday.org.au
●       pgCon May 21-24 Ottawa
●       me: www.databasesoup.com
    –   josh@postgresql.org
          This talk is copyright 2013 Josh Berkus, and is licensed under the Creative Commons Attribution License.
          Most images are the property of their respective copyright holders, and are used here for purposes of satire.

More Related Content

PDF
Linux system admin
PDF
Ubuntu – Linux Useful Commands
PDF
semaphore & mutex.pdf
PPTX
Understanding DPDK
PDF
Performance Profiling in Rust
PDF
Process Address Space: The way to create virtual address (page table) of user...
PDF
DPDK In Depth
PPT
Concetti di base (per iniziare)
Linux system admin
Ubuntu – Linux Useful Commands
semaphore & mutex.pdf
Understanding DPDK
Performance Profiling in Rust
Process Address Space: The way to create virtual address (page table) of user...
DPDK In Depth
Concetti di base (per iniziare)

What's hot (20)

PPTX
DPDK KNI interface
PDF
Introduction to the LLVM Compiler System
PDF
Linux kernel debugging
PPT
Galvin-operating System(Ch4)
PPTX
Lecture 2 - ICT.pptx
PPTX
Summary of linux kernel security protections
PDF
Reverse Mapping (rmap) in Linux Kernel
PDF
LCA13: Xen on ARM
PPTX
COSCUP 2020 RISC-V 32 bit linux highmem porting
PDF
Os lab final
PPS
Harddisk
PPT
Part 1 - PROCESS CONCEPTS
PPT
Basic 50 linus command
PPT
Compression Commands in Linux
PPTX
Dpdk applications
PDF
Fault tolerant mechanisms in Big Data
PDF
Linux Kernel - Virtual File System
PDF
Linux 4.x Tracing: Performance Analysis with bcc/BPF
PDF
Linux basic commands with examples
PPT
Linux memory
DPDK KNI interface
Introduction to the LLVM Compiler System
Linux kernel debugging
Galvin-operating System(Ch4)
Lecture 2 - ICT.pptx
Summary of linux kernel security protections
Reverse Mapping (rmap) in Linux Kernel
LCA13: Xen on ARM
COSCUP 2020 RISC-V 32 bit linux highmem porting
Os lab final
Harddisk
Part 1 - PROCESS CONCEPTS
Basic 50 linus command
Compression Commands in Linux
Dpdk applications
Fault tolerant mechanisms in Big Data
Linux Kernel - Virtual File System
Linux 4.x Tracing: Performance Analysis with bcc/BPF
Linux basic commands with examples
Linux memory
Ad

Viewers also liked (12)

PDF
Introduction to PostgreSQL for System Administrators
PDF
Why PostgreSQL for Analytics Infrastructure (DW)?
PPTX
Dbms recovering from a system crash
PDF
Crash dump analysis - experience sharing
PDF
PostgreSQL and RAM usage
PPTX
Postgres MVCC - A Developer Centric View of Multi Version Concurrency Control
PDF
reference_guide_Kernel_Crash_Dump_Analysis
PDF
Database backup and recovery
PPT
Linux Crash Dump Capture and Analysis
PDF
Scaling postgres
PDF
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
PPT
17. Recovery System in DBMS
Introduction to PostgreSQL for System Administrators
Why PostgreSQL for Analytics Infrastructure (DW)?
Dbms recovering from a system crash
Crash dump analysis - experience sharing
PostgreSQL and RAM usage
Postgres MVCC - A Developer Centric View of Multi Version Concurrency Control
reference_guide_Kernel_Crash_Dump_Analysis
Database backup and recovery
Linux Crash Dump Capture and Analysis
Scaling postgres
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
17. Recovery System in DBMS
Ad

Similar to 7 Ways To Crash Postgres (20)

PDF
The Accidental DBA
ODP
Pro PostgreSQL, OSCon 2008
PDF
Whats wrong with postgres | PGConf EU 2019 | Craig Kerstiens
PDF
9.6_Course Material-Postgresql_002.pdf
PDF
PG Day'14 Russia, PostgreSQL System Architecture, Heikki Linnakangas
KEY
Grabbing the PostgreSQL Elephant by the Trunk
PDF
PostgreSQL Prologue
PPTX
Postgre sql best_practices
PDF
Trivadis TechEvent 2017 PostgreSQL für die (Orakel) DBA by Ludovico Caldara
PPTX
Tales from production with postgreSQL at scale
PDF
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
PDF
What's New in PostgreSQL 9.6
 
PPTX
Postgre sql best_practices
PDF
The Essential postgresql.conf
PPTX
TechEvent PostgreSQL Best Practices
ODP
Introduction to PostgreSQL
PDF
a look at the postgresql engine
PPTX
How to be a Postgres DBA in a Pinch
PPTX
Postgresql Database Administration Basic - Day1
PPTX
515689311-Postgresql-DBA-Architecture.pptx
The Accidental DBA
Pro PostgreSQL, OSCon 2008
Whats wrong with postgres | PGConf EU 2019 | Craig Kerstiens
9.6_Course Material-Postgresql_002.pdf
PG Day'14 Russia, PostgreSQL System Architecture, Heikki Linnakangas
Grabbing the PostgreSQL Elephant by the Trunk
PostgreSQL Prologue
Postgre sql best_practices
Trivadis TechEvent 2017 PostgreSQL für die (Orakel) DBA by Ludovico Caldara
Tales from production with postgreSQL at scale
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
What's New in PostgreSQL 9.6
 
Postgre sql best_practices
The Essential postgresql.conf
TechEvent PostgreSQL Best Practices
Introduction to PostgreSQL
a look at the postgresql engine
How to be a Postgres DBA in a Pinch
Postgresql Database Administration Basic - Day1
515689311-Postgresql-DBA-Architecture.pptx

More from PostgreSQL Experts, Inc. (20)

ODP
Shootout at the PAAS Corral
ODP
Shootout at the AWS Corral
ODP
Fail over fail_back
ODP
PostgreSQL Replication in 10 Minutes - SCALE
ODP
Give A Great Tech Talk 2013
PDF
Pg py-and-squid-pypgday
PDF
92 grand prix_2013
PDF
Five steps perform_2013
PDF
PWNage: Producing a newsletter with Perl
PDF
10 Ways to Destroy Your Community
PDF
Open Source Press Relations
PDF
5 (more) Ways To Destroy Your Community
PDF
Preventing Community (from Linux Collab)
PDF
Development of 8.3 In India
PDF
PostgreSQL and MySQL
PDF
50 Ways To Love Your Project
PDF
8.4 Upcoming Features
PDF
Elephant Roads: PostgreSQL Patches and Variants
PDF
Writeable CTEs: The Next Big Thing
Shootout at the PAAS Corral
Shootout at the AWS Corral
Fail over fail_back
PostgreSQL Replication in 10 Minutes - SCALE
Give A Great Tech Talk 2013
Pg py-and-squid-pypgday
92 grand prix_2013
Five steps perform_2013
PWNage: Producing a newsletter with Perl
10 Ways to Destroy Your Community
Open Source Press Relations
5 (more) Ways To Destroy Your Community
Preventing Community (from Linux Collab)
Development of 8.3 In India
PostgreSQL and MySQL
50 Ways To Love Your Project
8.4 Upcoming Features
Elephant Roads: PostgreSQL Patches and Variants
Writeable CTEs: The Next Big Thing

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PPT
Teaching material agriculture food technology
PDF
KodekX | Application Modernization Development
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Electronic commerce courselecture one. Pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Cloud computing and distributed systems.
DOCX
The AUB Centre for AI in Media Proposal.docx
Network Security Unit 5.pdf for BCA BBA.
Teaching material agriculture food technology
KodekX | Application Modernization Development
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine learning based COVID-19 study performance prediction
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
cuic standard and advanced reporting.pdf
NewMind AI Monthly Chronicles - July 2025
Electronic commerce courselecture one. Pdf
A Presentation on Artificial Intelligence
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
The Rise and Fall of 3GPP – Time for a Sabbatical?
Empathic Computing: Creating Shared Understanding
Cloud computing and distributed systems.
The AUB Centre for AI in Media Proposal.docx

7 Ways To Crash Postgres