Let me provide a comprehensive solution addressing all three optimization areas you need to focus on.
SQL Pruning Strategy:
First, rewrite your query to eliminate the TRUNC function and add proper filtering:
SELECT /*+ PARALLEL(4) */ emp.person_id, emp.assignment_id,
succ.succession_plan_id, succ.readiness_level,
perf.rating, perf.review_period
FROM per_all_people_f emp
JOIN succession_plans succ ON emp.person_id = succ.person_id
JOIN performance_reviews perf ON emp.person_id = perf.person_id
WHERE SYSDATE BETWEEN emp.effective_start_date
AND emp.effective_end_date
AND succ.active_flag = 'Y'
AND perf.review_period >= ADD_MONTHS(SYSDATE, -24)
The key changes: removed TRUNC to allow index usage, added active_flag filter on succession plans, and limited performance reviews to last 24 months. This pruning alone should reduce your dataset by 40-50%.
Explain Plan Analysis:
Run this before and after optimization:
EXPLAIN PLAN FOR [your query];
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
Look for these red flags in the output:
- Full table scans on large tables (succession_plans, performance_reviews)
- Hash joins without proper indexes
- High cost operations (>10000) in the execution path
Work with your DBA to add these indexes:
- succession_plans: (person_id, active_flag, succession_plan_id)
- performance_reviews: (person_id, review_period, rating)
- per_all_people_f: (person_id, effective_start_date, effective_end_date)
Parallel Execution Configuration:
For 500K+ records, parallel execution is essential. In your BI Publisher data model:
- Add the PARALLEL hint (shown above) with degree 4-8 depending on your HCM Cloud tier
- Configure data model properties: Row Fetch Size = 1000, Scalable Mode = On
- Set query timeout to 600 seconds (10 minutes) in Administration > System Settings
- Enable data model caching for frequently run reports
Additional Optimizations:
- Break complex data models into smaller, focused models
- Use bind variables for date ranges: WHERE review_period >= :P_START_DATE
- Consider materialized views for succession planning data (refreshed nightly)
- Implement report bursting to process subsets in parallel
Monitoring Results:
After implementing, track these metrics:
- Query execution time (target: under 3 minutes)
- Explain Plan cost (should drop by 60-70%)
- Timeout occurrences (should eliminate completely)
- System resource usage during report runs
This three-pronged approach - SQL pruning, Explain Plan-driven indexing, and parallel execution - should resolve your timeout issues. Start with the SQL pruning and indexing, then add parallelism. We’ve used this exact methodology to optimize similar Talent Management reports from 12+ minute timeouts to consistent 2-3 minute successful runs.