This chapter introduces you to logging and analyzing in PostgreSQL. Most of the important information related to locks, deadlocks, query executions, errors, or warnings are all logged to a PostgreSQL log file. It may be difficult for admins to tune a PostgreSQL database when such information is not logged. It is also important to see whether a query is generating temp and fetching pages from disk or memory. Even when all the information is available in logs, it may be difficult for someone to parse through the logs, whose size may range from several MBs to GBs.
For this purpose, this chapter has been designed to let admins know of the available options in PostgreSQL to enable the logging of certain important activities and to help admins/developers get familiar with some views, extensions, and tools to analyze live and historic activity...