Performance Degradation of On-Call Calendar where roster_schedule_spans exceeds 1000 recordsDescriptionPerformance Degradation of On-Call Calendar where roster_schedule_spans exceeds 1000 recordsSteps to Reproduce An On-Call rota that has a lot of Time Off, Extra Time, or Cover records in the past will notice a loading time performance degradation if these past records are not deleted.WorkaroundReduce the amount of past roster_schedule_span records. (Please note that this will mean that past: Extra Rota Time, User Assigned Coverage and Time Off records will no longer appear). Once the roster_schedule_span records exceeds 1000s per rota the performance may become degraded. Run the following in Scripts - Background: // Change the utcDate to a date that roster span records with end dates prior to it will be deleted var utcDate = "2016-01-02 00:00:00";deleteRosterSpansById(getRosterSpanIdsBeforeDate(utcDate)); function getRosterSpanIdsBeforeDate(utcDate) { var gdt = new GlideDateTime(); gdt.setValueUTC(utcDate, "yyyy-MM-dd HH:mm:ss"); var utcMillis = gdt.getNumericValue(); var rosterSchedSpansSysIds = []; var gr = new GlideRecord("roster_schedule_span"); gr.query(); while (gr.next()) { var sdt = new GlideScheduleDateTime(); sdt.setValue(gr.end_date_time); if (sdt.getMS() < utcMillis && gr.repeat_type == "") rosterSchedSpansSysIds.push(gr.getValue("sys_id")); } return rosterSchedSpansSysIds;} function deleteRosterSpansById(rosterSchedSpansSysIds) { var gr = new GlideRecord("roster_schedule_span"); // Disables the running of business rules that might normally be triggered by subsequent actions gr.setWorkflow(false); gr.addQuery("sys_id", "IN", rosterSchedSpansSysIds); gr.query(); gr.deleteMultiple();} Related Problem: PRB668746