Optimize contributions calendar queries
In !40014 (comment 403234710) we established that there are significant performance gains to be had by lifting out the common table expressions in the event_dates query of ContributionCalendar.
This looks capable of reducing query runtime down from 12sec to 4sec, depending on how we write it, but would be much more fiddly given AR's less than ideal support for CTE's. But the performance gains may be very significant.
Edited by 🤖 GitLab Bot 🤖