Browse Source

Performance boost

COStage_0.2_Release
Daniel Quathamer 3 years ago
parent
commit
8456ddc69e
  1. 48
      src-modules/module/costage/hilfstabellen/costage_st_studien_aggr_fuellen.sql

48
src-modules/module/costage/hilfstabellen/costage_st_studien_aggr_fuellen.sql

@ -24,6 +24,7 @@ S.second_nationality,
SG.fachkennzeichen, SG.fachkennzeichen,
ST.studienform_statistik_code, ST.studienform_statistik_code,
null::integer as st_studiengang_nr_msg, null::integer as st_studiengang_nr_msg,
null::integer as st_studiengang_nr_msg_primaerflag,
null::integer as st_studiengang_nr_tsg, null::integer as st_studiengang_nr_tsg,
null::integer as studienfach_sortierung, null::integer as studienfach_sortierung,
null::char(10) as hrst, null::char(10) as hrst,
@ -224,29 +225,30 @@ select st_studium_nr,
hssem, hssem,
primaerflag, primaerflag,
--Nun ist studiengang_nr=1 definiert. Die restlichen werden mit RANK ermittelt: --Nun ist studiengang_nr=1 definiert. Die restlichen werden mit RANK ermittelt:
-- (case when studiengang_nr is not null then studiengang_nr (case when studiengang_nr =1 then studiengang_nr
-- else else
-- dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr order by dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr order by
-- (case when studiengangs_typ_kb='TSG' then st_absz_nr else st_studium_nr end ))+1 (case when studiengangs_typ_kb='TSG' then st_absz_nr else st_studium_nr end ))+1
-- end) end)
-- as studiengang_nr, as studiengang_nr,
--AP Code:
(case when studiengangs_typ_kb ='TSG' then -- (case when studiengangs_typ_kb ='TSG' then
(case when primaerflag =1 -- (case when primaerflag =1
then 1 -- then 1
else -- else
(case when st_studiengang_nr_msg in (select distinct T2.st_studiengang_nr_msg from temp_tmp_studien2 T2 -- (case when st_studiengang_nr_msg in (select distinct T2.st_studiengang_nr_msg from temp_tmp_studien2 T2
where tmp_studien2.matrikelnummer = T2.matrikelnummer and tmp_studien2.semester = T2.Semester) -- where tmp_studien2.matrikelnummer = T2.matrikelnummer and tmp_studien2.semester = T2.Semester)
then 1 -- then 1
else -- else
dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr order by(case when studiengangs_typ_kb='TSG' then st_absz_nr else st_studium_nr end ))+1 -- dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr order by(case when studiengangs_typ_kb='TSG' then st_absz_nr else st_studium_nr end ))+1
end )end) -- end )end)
else -- else
(case when primaerflag =1 -- (case when primaerflag =1
then 1 -- then 1
else -- else
dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr order by( case when studiengangs_typ_kb='TSG' then st_absz_nr else st_studium_nr end ))+1 -- dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr order by( case when studiengangs_typ_kb='TSG' then st_absz_nr else st_studium_nr end ))+1
end) end ) as studiengang_nr2, -- end) end )
--as studiengang_nr2,
(case when primaerflag =1 then 1 (case when primaerflag =1 then 1
else else
dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr

Loading…
Cancel
Save