Operation 206415
SELECT users.* FROM users LEFT JOIN posts ON users.id = posts.user_id LEFT JOIN comments ON posts.id = comments.post_id WHERE users.active = ? AND posts.published = ? AND comments.approved = ? OR users.created_at > ? AND posts.created_at > ? AND comments.created_at > ?
- Operation Type
sql
- Duration
- 15.0 ms
- Request Impact
- 28.5% of total request time
- Occurred At
- Sep 15, 2026 7:21 AM
- SQL Analysis
- Normal query (<100 ms)
- Performance Comparison
-
Average: 18.1ms
95th Percentile: 34.0ms
Based on 1000 recent operations - Related Operations
- 1 similar operation in this request
- Optimization Tips
-
Add composite index: add_index :users, ["active", "published", "approved", "created_at"] - Efficient multi-column filteringAdd single_column index: add_index :comments, :post_id - Fast JOIN executionAdd single_column index: add_index :posts, :user_id - Fast JOIN executionAdd single_column index: add_index :users, :active - Fast lookups for active = value queriesAdd single_column index: add_index :users, :approved - Fast lookups for approved = value queriesAdd single_column index: add_index :users, :published - Fast lookups for published = value queriesAdd single_column index: add_index :users, :created_at - Efficient range scans for created_atConsider breaking complex query (complexity: 18) into smaller parts - Easier maintenance and potentially better performanceIndex Optimization - Review indexes on the 'users' table. Consider composite indexes for WHERE clauses.