P95 Query Time
34 ms
Compared to previous 7 days
Query Responses
Click marker to copy SHA
| Time Period ▼ | Executions | Avg Duration | Min Duration | Max Duration |
|---|---|---|---|---|
| Sep 23, 2026 | 18 | 17.11 ms | 4.0 ms | 35.0 ms |
| Sep 22, 2026 | 53 | 21.94 ms | 1.0 ms | 35.0 ms |
| Sep 21, 2026 | 65 | 18.22 ms | 1.0 ms | 35.0 ms |
| Sep 20, 2026 | 73 | 19.36 ms | 1.0 ms | 35.0 ms |
| Sep 19, 2026 | 48 | 17.44 ms | 1.0 ms | 35.0 ms |
| Sep 18, 2026 | 51 | 16.98 ms | 1.0 ms | 35.0 ms |
| Sep 17, 2026 | 70 | 17.21 ms | 1.0 ms | 35.0 ms |
| Sep 16, 2026 | 70 | 17.37 ms | 1.0 ms | 34.0 ms |
| Sep 15, 2026 | 51 | 19.96 ms | 4.0 ms | 45.0 ms |
| Sep 14, 2026 | 66 | 15.89 ms | 1.0 ms | 36.0 ms |
Total of 15 record(s).
Page 1 of 2
Normalized Query
SELECT * FROM users LEFT JOIN posts ON users.id = posts.user_id LEFT JOIN comments ON posts.id = comments.post_id LEFT JOIN tags ON posts.id = tags.post_id LEFT JOIN categories ON posts.category_id = categories.id WHERE users.active = ? AND posts.published = ? AND comments.approved = ? AND tags.name LIKE ? AND categories.visible = ? AND users.email LIKE ? AND posts.title LIKE ? OR comments.content LIKE ? AND users.created_at BETWEEN ? AND ? AND posts.updated_at > ? ORDER BY users.created_at, posts.created_at, comments.created_at
Diagnostics
Query Characteristics
- Query Type
- SELECT
- Tables
- 5
- Joins
- 4
- Complexity Score
- 33
- Has LIMIT
- No
- Has ORDER BY
- Yes
- Has GROUP BY
- No
- Has Subqueries
- No
Issues Detected
- Using SELECT * may retrieve unnecessary columns
- Complex WHERE clause with many conditions
Optimization Suggestions
-
Add composite index: add_index :users, ["active", "published", "approved", "visible", "created_at", "updated_at", "name", "email", "title", "content", "created_at", "created_at", "created_at"]
— Single index for filtering and sorting
add_index :users, ["active", "published", "approved", "visible", "created_at", "updated_at", "name", "email", "title", "content", "created_at", "created_at", "created_at"] -
Add composite index: add_index :users, ["active", "published", "approved", "visible", "created_at", "updated_at", "name", "email", "title", "content"]
— Efficient multi-column filtering
add_index :users, ["active", "published", "approved", "visible", "created_at", "updated_at", "name", "email", "title", "content"] -
Add single_column index: add_index :comments, :post_id
— Fast JOIN execution
add_index :comments, :post_id -
Add single_column index: add_index :posts, :category_id
— Fast JOIN execution
add_index :posts, :category_id -
Add single_column index: add_index :posts, :user_id
— Fast JOIN execution
add_index :posts, :user_id -
Add single_column index: add_index :tags, :post_id
— Fast JOIN execution
add_index :tags, :post_id -
Add single_column index: add_index :users, :active
— Fast lookups for active = value queries
add_index :users, :active -
Add single_column index: add_index :users, :approved
— Fast lookups for approved = value queries
add_index :users, :approved -
Add single_column index: add_index :users, :published
— Fast lookups for published = value queries
add_index :users, :published -
Add single_column index: add_index :users, :visible
— Fast lookups for visible = value queries
add_index :users, :visible
Query Locations
| Location | P95 Duration (ms) | P95 Row Count | Count |
|---|---|---|---|
app/controllers/search_controller.rb:12 |
34.0 | — | 496 |
app/jobs/webhook_delivery_job.rb:39 |
30.0 | — | 1 |
app/jobs/webhook_delivery_job.rb:119 |
45.0 | — | 1 |
app/jobs/cache_warming_job.rb:49 |
21.0 | — | 1 |
app/jobs/webhook_delivery_job.rb:100 |
19.0 | — | 1 |
Raw Data
{
"query": {
"id": 15,
"normalized_sql": "SELECT * FROM users LEFT JOIN posts ON users.id = posts.user_id LEFT JOIN comments ON posts.id = comments.post_id LEFT JOIN tags ON posts.id = tags.post_id LEFT JOIN categories ON posts.category_id = categories.id WHERE users.active = ? AND posts.published = ? AND comments.approved = ? AND tags.name LIKE ? AND categories.visible = ? AND users.email LIKE ? AND posts.title LIKE ? OR comments.content LIKE ? AND users.created_at BETWEEN ? AND ? AND posts.updated_at > ? ORDER BY users.created_at, posts.created_at, comments.created_at",
"analyzed_at": "2026-09-23 03:45:50 UTC"
},
"performance": {
"total_executions": 500,
"p95_duration_ms": "34.0",
"avg_duration_ms": 18.432,
"p95_row_count": null,
"avg_row_count": null
},
"characteristics": {
"query_type": "SELECT",
"table_count": 5,
"join_count": 4,
"where_clause_complexity": 11,
"has_subqueries": false,
"has_limit": false,
"has_order_by": true,
"has_group_by": false,
"has_having": false,
"has_distinct": false,
"has_aggregations": false,
"estimated_complexity": 33
},
"call_locations": [
{
"location": "app/controllers/search_controller.rb:12",
"count": 496,
"p95_duration_ms": "34.0",
"p95_row_count": null
},
{
"location": "app/jobs/webhook_delivery_job.rb:39",
"count": 1,
"p95_duration_ms": "30.0",
"p95_row_count": null
},
{
"location": "app/jobs/webhook_delivery_job.rb:119",
"count": 1,
"p95_duration_ms": "45.0",
"p95_row_count": null
},
{
"location": "app/jobs/cache_warming_job.rb:49",
"count": 1,
"p95_duration_ms": "21.0",
"p95_row_count": null
},
{
"location": "app/jobs/webhook_delivery_job.rb:100",
"count": 1,
"p95_duration_ms": "19.0",
"p95_row_count": null
}
],
"n_plus_one": {
"detected": false
},
"index_recommendations": [
"add_index :users, :active",
"add_index :users, :published",
"add_index :users, :approved",
"add_index :users, :visible",
"add_index :posts, :user_id",
"add_index :comments, :post_id",
"add_index :tags, :post_id",
"add_index :posts, :category_id",
"add_index :users, [\"active\", \"published\", \"approved\", \"visible\", \"created_at\", \"updated_at\", \"name\", \"email\", \"title\", \"content\", \"created_at\", \"created_at\", \"created_at\"]",
"add_index :users, [\"active\", \"published\", \"approved\", \"visible\", \"created_at\", \"updated_at\", \"name\", \"email\", \"title\", \"content\"]",
"add_index :users, :created_at",
"add_index :users, :updated_at",
"add_index :users, [\"created_at\", \"created_at\", \"created_at\"]"
],
"issues": [
"Using SELECT * may retrieve unnecessary columns",
"Complex WHERE clause with many conditions"
]
}