with UPD as (
select
es.evnsection_id
from v_EvnPS ps
join v_EvnSection es on ps.evnps_id = es.evnsection_pid
where
(ps.evnps_disdate::date >= '01.01.2022'::Date or ps.evnps_setdate::Date >= '01.01.2022'::Date)
and es.evnsection_ispriem is distinct from 2
ORDER BY 1
limit 5000 offset 20000
)
select
r52.evnps_kslp_calc_2022(u.evnsection_id)
from upd AS u
