Subject Re: Query is running slowly for the first time.
Author un_spoken
My mistake, SECOND execution time:

Starting transaction...
Preparing statement: SELECT r.ID_SHEDULEVERSION, r.RECORD_ID, r.RECORD_TIME, r.RECORD_ACTIVE
FROM SHEDULEVERSION r
LEFT JOIN CALC_TASKS_STATS_FOR_SHEDVER(r.ID_SHEDULEVERSION) ON 1= 1
WHERE r.RECORD_ACTIVE = 1 AND R.STARTDATE >= '01.05.2012' AND R.STOPDATE <= '09.05.2012'
Statement prepared (elapsed time: 0.000s).
Field #01: SHEDULEVERSION.ID_SHEDULEVERSION Alias:ID_SHEDULEVERSION Type:INTEGER
Field #02: SHEDULEVERSION.RECORD_ID Alias:RECORD_ID Type:INTEGER
Field #03: SHEDULEVERSION.RECORD_TIME Alias:RECORD_TIME Type:TIMESTAMP
Field #04: SHEDULEVERSION.RECORD_ACTIVE Alias:RECORD_ACTIVE Type:INTEGER
PLAN JOIN (R INDEX (IDX_SHEDULEVERSION1), JOIN (S INDEX (IDX_SHEDULE_IDUPPER, IDX_SHEDULE_RA_SHD_VER), CALC_TASKS_STATS_FOR_SHEDULE NATURAL))


Executing statement...
Statement executed (elapsed time: 0.000s).
846233 fetches, 0 marks, 41862 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 375295 index, 0 seq.
Delta memory: 16472 bytes.
Total execution time: 1.368s
Script execution finished.