Find Slow Database Queries
Requests and background jobs can be slow for various reasons, but a common cause are slow database queries. Large tables and missing indexes may cause database queries to take longer than needed, increasing the amount of time that your application's users have to wait.
AppSignal's Slow Queries feature makes it easier to find an application's slowest queries, to help you decide which queries require optimization.
You can view your application's slow queries here.
Finding Slow Queries
In the slow queries page a list of queries is displayed on the left-hand side of the screen. By default, this list is sorted by impact.
The type of events that can be found in the Slow Queries page are listed below.
- Elasticsearch
- MongoDB
- MySQL
- PostgreSQL
- Redis
- SQLite
Events may be grouped under the ORM (Object-relational mapping) event group name for some integrations.
Sorting Queries
By default the slow query list is sorted by impact: the queries that take up the most time either by duration of queries or by how often they are performed.
It is also possible to sort this table by "Throughput", how often the query has been recorded, and "Mean", the mean duration of the queries.
Query Details
You can click on a query to gain the following insights:
- Full query with optional event title for more context
- The database query event summary:
- Mean duration of query
- Throughput, how often the query was recorded
- The impact of the query in percentage of all database queries in the selected timeframe.
- Response time graph
- Throughput graph
- Actions and performance measurements in which the event occurred:
- You can go directly to actions and performance measurements in which the event was recorded to view the impact per request/background job in the sample event timeline.