-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

PostgreSQL 10 Administration Cookbook

An SQL statement can be slow for a lot of reasons. Here, we will give a short list of these, with at least one way of recognizing each reason.
If the SQL statement is still running, look at Chapter 8, Monitoring and Diagnosis.
The core issues are likely to be one of these:
This might not sound that helpful at first, but it's good to know that there's nothing really magical going on that you can't understand if you look.
In more detail, the main reasons are:
The first reason can be handled as described in the Reducing the number of rows returned recipe.Reasons 2-4can be investigated from two perspectives:TheSQLitselfand the objects that the SQL touches. Let's start by looking at the SQLitselfby running the query with EXPLAIN
ANALYZE
. We...