- 
    Type:Improvement 
- 
    Resolution: Done
- 
    Priority:Major 
- 
    Component/s: DB, SolarQuery
- 
    None
The find_datm_for_time_slot and find_datm_diff_near_rows stored procedures are written in SQL, using many CTE and COALESCE techniques to optimize performance. Investigate if switching to plpgsql could improve their performance, as swiching other sub-procedures like find_time_before_ts to plpgsql was found to boost performance by decreasing query planning time and allowing for execution plans that pruned unnecessary chunks from the da_datm hypertable.