PostgreSQL is a reliable open source database available in many modern distribution’s repository. The ease of use, the ability to use extensions and the stability it provides all add to it’s popularity. While providing the base functionality, like answering to SQL queries, store inserted data consistently, handling transactions, etc. most mature database solutions provide tools and know-hows on how to tune the database, identify possible bottlenecks, and be able to solve performance problems bound to happen as the system powered by the given solution grows.
PostgreSQL is no exception, and in this guide we’ll use the built in tool
explain to make a slow-running query complete faster. It is far from a real world database, but one can take the hint on the usage of the built in tools. We’ll use a PostgreSQL server version 9.2 on Red Hat Linux 7.5, but the tools shown in this guide are present in much older database and operating system versions as well.