SlideShare a Scribd company logo
Copyright 2015 Uptime Technologies, LLC. All rights reserved. 1
A “Victorinox” for PostgreSQL DBA
Postgres Toolkit
Satoshi Nagayasu
@snaga
pgcon2015
2015/6/18
What is “Postgres Toolkit”?
• A collection of scripts and utilities to manage
PostgreSQL servers
• Allows DBA to perform complicated tasks with single
commands
• Focusing on frequent tasks for PostgreSQL DBA to
improve their productivity and quality of operations
• Distributed under the open source license (GPLv2)
Copyright 2015 Uptime Technologies, LLC. All rights reserved. 2
Postgres Toolkit 0.2.1
• Released on May 2015
– Consists of 13 scripts
• Supported Platforms and Versions
– Red Hat Enterprise Linux 6 / CentOS 6
– Red Hat Enterprise Linux 7 / CentOS 7
– Ubuntu 14.04 LTS
– PostgreSQL 9.0〜9.4
• Source code
– https://github.com/uptimejp/postgres-toolkit
• Documentation
– http://postgres-toolkit.readthedocs.org/
Copyright 2015 Uptime Technologies, LLC. All rights reserved. 3
Installation
Copyright 2015 Uptime Technologies, LLC. All rights reserved. 4
[root@devvm04 ~]# curl ‐L http://dl.uptimeforce.com/postgres‐toolkit/install.sh | sh
% Total    % Received % Xferd Average Speed   Time    Time Time Current
Dload Upload   Total   Spent    Left  Speed
140   280  140   280    0     0    550      0 ‐‐:‐‐:‐‐ ‐‐:‐‐:‐‐ ‐‐:‐‐:‐‐ 5833
% Total    % Received % Xferd Average Speed   Time    Time Time Current
Dload Upload   Total   Spent    Left  Speed
100  275k  100  275k    0     0   307k      0 ‐‐:‐‐:‐‐ ‐‐:‐‐:‐‐ ‐‐:‐‐:‐‐ 486k
opt/uptime/postgres‐toolkit‐0.2/
opt/uptime/postgres‐toolkit‐0.2/bin/
opt/uptime/postgres‐toolkit‐0.2/bin/pt‐config
opt/uptime/postgres‐toolkit‐0.2/bin/pt‐snap‐statements
opt/uptime/postgres‐toolkit‐0.2/bin/pt‐proc‐stat
(...snip...)
opt/uptime/postgres‐toolkit‐0.2/lib/DirectoryTree.pyc
opt/uptime/postgres‐toolkit‐0.2/lib/TcpdumpWrapper.py
opt/uptime/postgres‐toolkit‐0.2/LICENSE
[root@devvm04 ~]# ls /opt/uptime/postgres‐toolkit‐0.2/
LICENSE  bin  docs  lib  share  src
[root@devvm04 ~]# ls /opt/uptime/postgres‐toolkit‐0.2/bin/
pt‐config pt‐replication‐stat  pt‐stat‐snapshot     pt‐xact‐stat
pt‐index‐usage  pt‐session‐profiler  pt‐table‐usage       verifychecksum.bin
pt‐kill         pt‐set‐tablespace pt‐tablespace‐usage
pt‐proc‐stat    pt‐snap‐statements   pt‐verify‐checksum
[root@devvm04 ~]#
http://postgres-toolkit.readthedocs.org/en/latest/install.html#id2
Command list
Command Description
pt-config
Show and set parameters in postgresql.conf, the PostgreSQL configuration file, without using
editor (like emacs or vi.)
pt-index-usage
Show index usage, including index size, tuple/block access statistics, timestamp of
vacuum/analyze, and tablespace name at once.
pt-kill Send signal to a backend to cancel a running query or to terminate the backend safely.
pt-proc-stat
Show status and process statistics, including disk I/O and network I/O, of each process in the
PostgreSQL instance.
pt-replication-stat
Show status and statistics of master and slave node(s) at once, which a replication cluster
consists of.
pt-session-profiler
Show queries, which exceeded specified elapsed time, by capturing network traffice and
analyze it.
pt-set-tablespace Change tablespace for multiple tables and releted indexes at once.
pt-snap-statements Show statistics of queries which ran in the specified period of time.
pt-stat-snapshot Take snapshots of several statistics which can be obtained in PostgreSQL, and manage them.
pt-table-usage
Show table usage, including table size, tuple/block access statistics, timestamp of
vacuum/analyze, and tablespace name at once.
pt-tablespace-usage
Summarize tablespace usage per database, and show them with available space size of the
partition.
pt-verify-checksum
Verify checksums of table and index files in a database cluster at once. (Supported 9.3 or
later)
pt-xact-stat
Show several statistics of multiple PostgreSQL instances at once, including number of
sessions and number of transactions (commit and rollbacks)
Copyright 2015 Uptime Technologies, LLC. All rights reserved. 5
pt-session-profiler
• Uses tcpdump internally.
• Extracts the FE/BE wire-protocol on the fly.
• Prints queries which exceed specific threshold.
• You donʼt need to change or touch your production
PostgreSQL.
Copyright 2015 Uptime Technologies, LLC. All rights reserved. 6

More Related Content

PDF
10 Reasons to Start Your Analytics Project with PostgreSQL
ODP
Pro PostgreSQL, OSCon 2008
PDF
Inside PostgreSQL Shared Memory
 
PDF
제3회난공불락 오픈소스 인프라세미나 - MySQL
PDF
제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나-CRUI
PDF
Linux con europe_2014_f
PPTX
Postgres-BDR with Google Cloud Platform
PDF
Mastering PostgreSQL Administration
 
10 Reasons to Start Your Analytics Project with PostgreSQL
Pro PostgreSQL, OSCon 2008
Inside PostgreSQL Shared Memory
 
제3회난공불락 오픈소스 인프라세미나 - MySQL
제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나-CRUI
Linux con europe_2014_f
Postgres-BDR with Google Cloud Platform
Mastering PostgreSQL Administration
 

What's hot (20)

PDF
PostgreSQL Performance Tuning
PDF
PostgreSQL Extensions: A deeper look
PDF
High Availability PostgreSQL with Zalando Patroni
PDF
Patroni - HA PostgreSQL made easy
PDF
Streaming replication in practice
PDF
Как PostgreSQL работает с диском
PDF
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
PDF
pg / shardman: шардинг в PostgreSQL на основе postgres / fdw, pg / pathman и ...
PDF
PostgreSQL High Availability in a Containerized World
PDF
MySQL Audit using Percona audit plugin and ELK
PPT
Planning for-high-performance-web-application
PDF
Introduction to PostgreSQL for System Administrators
PDF
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
PDF
PostgreSQL replication
PDF
PostgreSQL Replication with Bucardo
PDF
Mvcc in postgreSQL 권건우
PDF
Operating PostgreSQL at Scale with Kubernetes
PDF
GitLab PostgresMortem: Lessons Learned
PDF
What is new in PostgreSQL 14?
PDF
PostgreSQL on Solaris
PostgreSQL Performance Tuning
PostgreSQL Extensions: A deeper look
High Availability PostgreSQL with Zalando Patroni
Patroni - HA PostgreSQL made easy
Streaming replication in practice
Как PostgreSQL работает с диском
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
pg / shardman: шардинг в PostgreSQL на основе postgres / fdw, pg / pathman и ...
PostgreSQL High Availability in a Containerized World
MySQL Audit using Percona audit plugin and ELK
Planning for-high-performance-web-application
Introduction to PostgreSQL for System Administrators
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
PostgreSQL replication
PostgreSQL Replication with Bucardo
Mvcc in postgreSQL 권건우
Operating PostgreSQL at Scale with Kubernetes
GitLab PostgresMortem: Lessons Learned
What is new in PostgreSQL 14?
PostgreSQL on Solaris
Ad

Viewers also liked (8)

PDF
PL/Pythonで独自の集約関数を作ってみる
PDF
Postgres Toolkitのご紹介
PDF
OSC沖縄2014_JPUG資料
PDF
20140531 JPUGしくみ+アプリケーション分科会 勉強会資料
PDF
明日から使えるPostgre sql運用管理テクニック(監視編)
PDF
Postgre sql9.3 newlockmode_and_etc
PDF
PostgreSQLセキュリティ総復習
PDF
PostgreSQLアーキテクチャ入門(PostgreSQL Conference 2012)
PL/Pythonで独自の集約関数を作ってみる
Postgres Toolkitのご紹介
OSC沖縄2014_JPUG資料
20140531 JPUGしくみ+アプリケーション分科会 勉強会資料
明日から使えるPostgre sql運用管理テクニック(監視編)
Postgre sql9.3 newlockmode_and_etc
PostgreSQLセキュリティ総復習
PostgreSQLアーキテクチャ入門(PostgreSQL Conference 2012)
Ad

Similar to Postgres Toolkit (20)

PPTX
PostgreSQL as a Strategic Tool
 
PPTX
EDB: Power to Postgres
PPTX
PostgreSQL as a Strategic Tool
 
PDF
Expanding with EDB Postgres Advanced Server 9.5
 
PDF
A Peek in the Elephant's Trunk
 
PPTX
Tales from the Postgres Front - and What We Can Learn
 
PPTX
Enterprise-class security with PostgreSQL - 2
PPTX
New enhancements for security and usability in EDB 13
 
PDF
EnterpriseDB's Best Practices for Postgres DBAs
 
PDF
PostgreSQL 9.4 and Beyond @ FOSSASIA 2015 Singapore
PPTX
EDB Database Servers and Tools
PDF
Beyond Postgres: Interesting Projects, Tools and forks
PDF
Exploring Postgres with Bruce Momjian
 
PDF
Which postgres is_right_for_me_20130517
 
PDF
Best Practices for Becoming an Exceptional Postgres DBA
 
PPTX
Community vs. Commercial Open Source
PDF
Trivadis TechEvent 2017 PostgreSQL für die (Orakel) DBA by Ludovico Caldara
PPTX
Neuerungen in EDB Postgres 11
 
PDF
The Accidental DBA
PDF
Introduction of pg_statsinfo and pg_stats_reporter ~Statistics Reporting Tool...
PostgreSQL as a Strategic Tool
 
EDB: Power to Postgres
PostgreSQL as a Strategic Tool
 
Expanding with EDB Postgres Advanced Server 9.5
 
A Peek in the Elephant's Trunk
 
Tales from the Postgres Front - and What We Can Learn
 
Enterprise-class security with PostgreSQL - 2
New enhancements for security and usability in EDB 13
 
EnterpriseDB's Best Practices for Postgres DBAs
 
PostgreSQL 9.4 and Beyond @ FOSSASIA 2015 Singapore
EDB Database Servers and Tools
Beyond Postgres: Interesting Projects, Tools and forks
Exploring Postgres with Bruce Momjian
 
Which postgres is_right_for_me_20130517
 
Best Practices for Becoming an Exceptional Postgres DBA
 
Community vs. Commercial Open Source
Trivadis TechEvent 2017 PostgreSQL für die (Orakel) DBA by Ludovico Caldara
Neuerungen in EDB Postgres 11
 
The Accidental DBA
Introduction of pg_statsinfo and pg_stats_reporter ~Statistics Reporting Tool...

More from Uptime Technologies LLC (JP) (11)

PDF
pgstattuple2: デッドタプル推定のための統計的手法
PDF
「今そこにある危機」を捉える ~ pg_stat_statements revisited
PDF
PostgreSQLバックアップの基本
PDF
BigDataを迎え撃つ! PostgreSQL並列分散ミドルウェア「Stado」の紹介と検証報告
PDF
いまさら聞けないPostgreSQL運用管理
PDF
PostgreSQLアーキテクチャ入門(INSIGHT OUT 2011)
PDF
PostgreSQL Query Cache - "pqc"
PDF
PostgreSQLアーキテクチャ入門
PDF
Uptime Database Appliance テクノロジープレビュー
PDF
5ステップで始めるPostgreSQLレプリケーション@hbstudy#13
PDF
PostgreSQL安定運用のコツ2009 @hbstudy#5
pgstattuple2: デッドタプル推定のための統計的手法
「今そこにある危機」を捉える ~ pg_stat_statements revisited
PostgreSQLバックアップの基本
BigDataを迎え撃つ! PostgreSQL並列分散ミドルウェア「Stado」の紹介と検証報告
いまさら聞けないPostgreSQL運用管理
PostgreSQLアーキテクチャ入門(INSIGHT OUT 2011)
PostgreSQL Query Cache - "pqc"
PostgreSQLアーキテクチャ入門
Uptime Database Appliance テクノロジープレビュー
5ステップで始めるPostgreSQLレプリケーション@hbstudy#13
PostgreSQL安定運用のコツ2009 @hbstudy#5

Recently uploaded (20)

PPTX
CHAPTER 2 - PM Management and IT Context
PDF
System and Network Administration Chapter 2
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
Essential Infomation Tech presentation.pptx
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Transform Your Business with a Software ERP System
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
AI in Product Development-omnex systems
PDF
System and Network Administraation Chapter 3
CHAPTER 2 - PM Management and IT Context
System and Network Administration Chapter 2
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
VVF-Customer-Presentation2025-Ver1.9.pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Essential Infomation Tech presentation.pptx
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Transform Your Business with a Software ERP System
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Reimagine Home Health with the Power of Agentic AI​
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Softaken Excel to vCard Converter Software.pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
2025 Textile ERP Trends: SAP, Odoo & Oracle
Navsoft: AI-Powered Business Solutions & Custom Software Development
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
AI in Product Development-omnex systems
System and Network Administraation Chapter 3

Postgres Toolkit

  • 1. Copyright 2015 Uptime Technologies, LLC. All rights reserved. 1 A “Victorinox” for PostgreSQL DBA Postgres Toolkit Satoshi Nagayasu @snaga pgcon2015 2015/6/18
  • 2. What is “Postgres Toolkit”? • A collection of scripts and utilities to manage PostgreSQL servers • Allows DBA to perform complicated tasks with single commands • Focusing on frequent tasks for PostgreSQL DBA to improve their productivity and quality of operations • Distributed under the open source license (GPLv2) Copyright 2015 Uptime Technologies, LLC. All rights reserved. 2
  • 3. Postgres Toolkit 0.2.1 • Released on May 2015 – Consists of 13 scripts • Supported Platforms and Versions – Red Hat Enterprise Linux 6 / CentOS 6 – Red Hat Enterprise Linux 7 / CentOS 7 – Ubuntu 14.04 LTS – PostgreSQL 9.0〜9.4 • Source code – https://github.com/uptimejp/postgres-toolkit • Documentation – http://postgres-toolkit.readthedocs.org/ Copyright 2015 Uptime Technologies, LLC. All rights reserved. 3
  • 4. Installation Copyright 2015 Uptime Technologies, LLC. All rights reserved. 4 [root@devvm04 ~]# curl ‐L http://dl.uptimeforce.com/postgres‐toolkit/install.sh | sh % Total    % Received % Xferd Average Speed   Time    Time Time Current Dload Upload   Total   Spent    Left  Speed 140   280  140   280    0     0    550      0 ‐‐:‐‐:‐‐ ‐‐:‐‐:‐‐ ‐‐:‐‐:‐‐ 5833 % Total    % Received % Xferd Average Speed   Time    Time Time Current Dload Upload   Total   Spent    Left  Speed 100  275k  100  275k    0     0   307k      0 ‐‐:‐‐:‐‐ ‐‐:‐‐:‐‐ ‐‐:‐‐:‐‐ 486k opt/uptime/postgres‐toolkit‐0.2/ opt/uptime/postgres‐toolkit‐0.2/bin/ opt/uptime/postgres‐toolkit‐0.2/bin/pt‐config opt/uptime/postgres‐toolkit‐0.2/bin/pt‐snap‐statements opt/uptime/postgres‐toolkit‐0.2/bin/pt‐proc‐stat (...snip...) opt/uptime/postgres‐toolkit‐0.2/lib/DirectoryTree.pyc opt/uptime/postgres‐toolkit‐0.2/lib/TcpdumpWrapper.py opt/uptime/postgres‐toolkit‐0.2/LICENSE [root@devvm04 ~]# ls /opt/uptime/postgres‐toolkit‐0.2/ LICENSE  bin  docs  lib  share  src [root@devvm04 ~]# ls /opt/uptime/postgres‐toolkit‐0.2/bin/ pt‐config pt‐replication‐stat  pt‐stat‐snapshot     pt‐xact‐stat pt‐index‐usage  pt‐session‐profiler  pt‐table‐usage       verifychecksum.bin pt‐kill         pt‐set‐tablespace pt‐tablespace‐usage pt‐proc‐stat    pt‐snap‐statements   pt‐verify‐checksum [root@devvm04 ~]# http://postgres-toolkit.readthedocs.org/en/latest/install.html#id2
  • 5. Command list Command Description pt-config Show and set parameters in postgresql.conf, the PostgreSQL configuration file, without using editor (like emacs or vi.) pt-index-usage Show index usage, including index size, tuple/block access statistics, timestamp of vacuum/analyze, and tablespace name at once. pt-kill Send signal to a backend to cancel a running query or to terminate the backend safely. pt-proc-stat Show status and process statistics, including disk I/O and network I/O, of each process in the PostgreSQL instance. pt-replication-stat Show status and statistics of master and slave node(s) at once, which a replication cluster consists of. pt-session-profiler Show queries, which exceeded specified elapsed time, by capturing network traffice and analyze it. pt-set-tablespace Change tablespace for multiple tables and releted indexes at once. pt-snap-statements Show statistics of queries which ran in the specified period of time. pt-stat-snapshot Take snapshots of several statistics which can be obtained in PostgreSQL, and manage them. pt-table-usage Show table usage, including table size, tuple/block access statistics, timestamp of vacuum/analyze, and tablespace name at once. pt-tablespace-usage Summarize tablespace usage per database, and show them with available space size of the partition. pt-verify-checksum Verify checksums of table and index files in a database cluster at once. (Supported 9.3 or later) pt-xact-stat Show several statistics of multiple PostgreSQL instances at once, including number of sessions and number of transactions (commit and rollbacks) Copyright 2015 Uptime Technologies, LLC. All rights reserved. 5
  • 6. pt-session-profiler • Uses tcpdump internally. • Extracts the FE/BE wire-protocol on the fly. • Prints queries which exceed specific threshold. • You donʼt need to change or touch your production PostgreSQL. Copyright 2015 Uptime Technologies, LLC. All rights reserved. 6