Generating a stack trace of a PostgreSQL backend

From PostgreSQL wiki
Jump to navigationJump to search

A stack trace is a list showing roughly how a program got to a certain point in its execution and what it is doing right now. If you have a copy of PostgreSQL that's unexpectedly using lots of CPU, or is sitting there doing nothing when it should be busy, or is throwing an unexplainable error, a stack trace may help you or somebody on the PostgreSQL mailing list figure out why.

A stack trace can also be obtained when a program crashes, providing potentially important information about what the program was doing when it crashed and where it went wrong.

Before you go to the trouble of collecting stack trace information please read the Guide to reporting problems and make sure you are running the latest patch release of your major version. If you're running 8.3.1 and the current version in the 8.3 series is 8.3.7, you're probably wasting your time tracking down a problem that was long since fixed.

How to get a stack trace varies by operating system.