Hi all, As database grows day by day, my need is to improve sql plan in order to decrease executing time. Please find my code below, it executes about 96 msecs, but when it works on real data (65000 contragentid) it executes too long... Could you please show me how do I improve sql statement? I've got values for each workday of month in table. Chief said we don't load values of dayoff because of space and time economy. Dayoff value is copy of last workday. The purpose of sql statement is to count averages (including days off), actually it's weighted average. Please find my session resource profile out file attached, hope it helps. Please, be so kind, help me improve performance.