Join us for our webinar on June 18th, 9:30am Pacific Time: Optimizing slow queries with EXPLAIN to fix bad query plans - register now.

New Slow Queries

Check Frequency

Daily

Default Configuration

Detects queries whose average execution time in the last 24 hours is over the specified threshold of 50ms and creates an issue with severity "info".

Ignores queries that are still running or that have executed fewer than 50 times.

This check is enabled by default. These parameters can be tuned in the Configure section of the Alerts & Check-Up page.

Guidance

Impact

Slow queries usually consume more CPU or I/O resources; can hold locks, blocking other queries; and lead to bad user experience due to poor responsiveness in your application. They may also be symptoms of other issues like table bloat or hardware problems.

Common Causes

  • Slow system

    If overall system performance is slow, due to either higher workload, operational issues, or hardware problems, this slow query may be just a symptom, and not a problem to fix directly. Check the current workload on the Query Performance overview, check any wait events on the Wait Events page, or check System metrics for overall activity.

  • Missing index

    If a query lacks the necessary indexes to execute efficiently, it may take longer and use more I/O than necessary, causing a negative impact on the whole system. Check the query page to review indexing recommendations.

  • Data changes

    If the the data accessed by a query changes dramatically (either grows in size or changes in terms of statistics relevant to query planning ), the query may start performing poorly. You may need to change indexes, change the default or per-column statistics targets , or create auxiliary statistics to give Postgres more information about the distribution of the underlying data. You should also check vacuum activity on the tables involved to make sure bloat is under control and that the tables have been analyzed recently.

  • Inefficient plan

    The query may be executing slowly due to an inefficient plan for other reasons. Review the query execution plans and Explain Insights listed for the query.


Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →