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, @@ -24,6 +24,7 @@ S.second_nationality,
SG.fachkennzeichen,
ST.studienform_statistik_code,
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 studienfach_sortierung,
null::char(10) as hrst,
@ -224,29 +225,30 @@ select st_studium_nr, @@ -224,29 +225,30 @@ select st_studium_nr,
hssem,
primaerflag,
--Nun ist studiengang_nr=1 definiert. Die restlichen werden mit RANK ermittelt:
-- (case when studiengang_nr is not null then studiengang_nr
-- 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
-- end)
-- as studiengang_nr,
(case when studiengangs_typ_kb ='TSG' then
(case when primaerflag =1
then 1
else
(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)
then 1
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
end )end)
else
(case when primaerflag =1
then 1
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
end) end ) as studiengang_nr2,
(case when studiengang_nr =1 then studiengang_nr
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
end)
as studiengang_nr,
--AP Code:
-- (case when studiengangs_typ_kb ='TSG' then
-- (case when primaerflag =1
-- then 1
-- else
-- (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)
-- then 1
-- 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
-- end )end)
-- else
-- (case when primaerflag =1
-- then 1
-- 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
-- end) end )
--as studiengang_nr2,
(case when primaerflag =1 then 1
else
dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr

Loading…
Cancel
Save