Skip to content

A collection of useful little scripts for database analysis and administration, created by our team at PostgreSQL Experts.

License

Notifications You must be signed in to change notification settings

ijaz14/pgx_scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgx_scripts

A collection of useful little scripts for database analysis and administration, created by our team at PostgreSQL Experts.

administration

kill_idle_91.sql

A stored procedure which kills idle transactions on PostgreSQL versions 8.3 to 9.1. Intended to be called by a cron job. Takes idle time, polling time, and exempted user list parameters. Outputs pipe-delimited text with the data about the sessions killed.

kill_idle_93.sql

A stored procedure which kills idle transactions on PostgreSQL versions 9.2 and later. Intended to be called by a cron job. Takes idle time and exempted user list parameters. Outputs JSON with the data about the sessions killed.

index_bloat_check.sql

An overhauled index bloat check. Lists indexes which are likely to be bloated and estimates bloat amounts. Requires PostgreSQL > 8.4, superuser access, and a 64-bit compile.

table_bloat_check.sql

An overhauled table bloat check. Lists tables which are likely to be bloated and estimates bloat amounts. Requires PostgreSQL >= 8.4, superuser access, and a 64-bit compile.

Locks

Tools and a set of queries to analyze lock-blocking.

transaction_locks.sql

Requires: Postgres 9.2+

Lists waiting transaction locks and what they're waiting on, if possible. Includes relation and query information, but realistically needs to be accompanied by full query logging to be useful. Needs to be run per active database.

Additional Contributors

In addition to the staff of PostgreSQL Experts, we are indebted to:

  • The authors of the check_postgres.pl script for supplying the original bloat queries on which our bloat queries are based.
  • Andrew Gierth for help on various system queries.

About

A collection of useful little scripts for database analysis and administration, created by our team at PostgreSQL Experts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 80.9%
  • Python 14.2%
  • PLpgSQL 4.9%