---
title: "Find and fix a slow query | Grafana Labs"
description: "Choose one slow query on your own database, read why it is slow, apply a matching fix, and compare the numbers afterward."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Find and fix a slow query

This path runs on your own Grafana Cloud stack and your own MySQL or PostgreSQL database. It tells you what to record. The slow-query guide assumes at least one database is already connected. Based on your diagnosis, apply the appropriate fix. After applying changes, confirm they worked.

If you have not connected a database yet, [Introduction to monitoring databases](https://grafana.com/docs/learning-hub/intro-to-db-olly/): how to set it up for MySQL or PostgreSQL.

## Here’s what to expect

When you complete this path, you’ll be able to:

- Choose one query by duration, errors, and how often it runs
- Read the explain plan and the table schema, and record what you found
- Read the query samples and the wait events, and record what you found
- Apply the fix that matches what you recorded
- Compare duration, errors, and calls after you apply the fix

## Before you begin

- Database Observability is already receiving data from your database.
- The database is MySQL 8.0 or later, or PostgreSQL 14 or later.
- Your Grafana Cloud account has the Editor or Admin role.
- You are allowed to change the database you pick, for example to add an index or to edit a query.

## Troubleshooting

If you get stuck, we’ve got your back! Where appropriate, troubleshooting information is just a click away.

## More to explore

We understand you might want to explore other capabilities not strictly on this path. We’ll provide you opportunities where it makes sense.

Are you ready?

[Let's go!](https://grafana.com/docs/learning-paths/find-and-fix-slow-query/choose-and-open-a-query/)
