I need help optimizing a SQL query that's currently experiencing performance issues. Please analyze the query and provide recommendations for improvement.
ORIGINAL QUERY:
```sql
[INSERT QUERY HERE]
```
CONTEXT:
- Database system: [SPECIFY DATABASE SYSTEM]
- Table information:
* [TABLE_NAME_1]: ~[ROW_COUNT_1] rows, [KEY_COLUMNS_1]
* [TABLE_NAME_2]: ~[ROW_COUNT_2] rows, [KEY_COLUMNS_2]
* [Additional tables as needed]
- Current indexes:
* [LIST EXISTING INDEXES]
- Performance issues:
* Current execution time: [CURRENT_TIME]
* Resource usage: [RESOURCE_USAGE]
* Problem areas: [KNOWN_ISSUES]
Please provide:
1. QUERY ANALYSIS
- Identify performance bottlenecks
- Highlight inefficient patterns
- Explain query execution concerns
2. OPTIMIZATION RECOMMENDATIONS
- Structure improvements (joins, subqueries, etc.)
- Filter and predicate optimizations
- Projection optimizations
- Aggregation improvements
3. INDEXING SUGGESTIONS
- New indexes with rationale
- Modifications to existing indexes
- Covering index opportunities
4. OPTIMIZED QUERY
- Provide refactored SQL code
- Include comments explaining key changes
5. EXPECTED BENEFITS
- Anticipated performance improvements
- Execution plan changes
- Resource utilization impact
6. TRADE-OFF CONSIDERATIONS
- Potential drawbacks
- Maintenance implications
- Alternative approaches
Please ensure the optimized query follows best practices for the specified database system and clearly explain your reasoning for each recommendation.