項目マスタView(k10v_citem)のパフォーマンス改善について

 
ビュー(k10v_citem)の再作成で、項目マスタを参照する機能のレスポンスが改善することがあります。
当改善は、2.0.13-PATCH_002、2.0.14に含まれています。
2.0.13-PATCH_002、2.0.14以降のバージョンの場合、適用する必要はありません。
当FAQに従ってビューを再作成した後に2.0.13-PATCH_002、2.0.14以降のバージョンにアップデートしても問題ありません。

■再作成対象のビュー
k10v_citem

■再作成用のSQL

・PostgreSQL
---------------------------------------
create or replace view k10v_citem
as
select
      itm_full.company_cd
    , itm_full.item_id
    , itm_full.locale_id
    , itm_full.item_type_cd
    , typ.item_type_name
    , itm_full.company_item_cd
    , itm_full.item_cd
    , itm_full.item_name
    , itm_full.sort_key
    , itm_full.allow_del_flag
    , itm_full.delete_flag
    , typ.extension_a as type_extension_a
    , typ.extension_b as type_extension_b
    , typ.extension_c as type_extension_c
    , typ.extension_d as type_extension_d
    , typ.extension_e as type_extension_e
    , typ.extension_f as type_extension_f
    , typ.extension_g as type_extension_g
    , typ.extension_h as type_extension_h
    , typ.extension_i as type_extension_i
    , typ.extension_j as type_extension_j
    , itm_full.extension_a
    , itm_full.extension_b
    , itm_full.extension_c
    , itm_full.extension_d
    , itm_full.extension_e
    , itm_full.extension_f
    , itm_full.extension_g
    , itm_full.extension_h
    , itm_full.extension_i
    , itm_full.extension_j
    , itm_full.entry_ts
    , itm_full.entry_user_cd
    , itm_full.renew_cnt
    , itm_full.renew_ts
    , itm_full.renew_user_cd
from (select
         itm.company_cd as company_cd
       , itm.item_id as item_id
       , itm.locale_id as locale_id
       , itm.item_type_cd as item_type_cd
       , cast(null as varchar(10)) as company_item_cd
       , itm.item_cd as item_cd
       , itm.item_name as item_name
       , itm.sort_key as sort_key
       , itm.allow_del_flag as allow_del_flag
       , '0' as delete_flag
       , itm.extension_a as extension_a
       , itm.extension_b as extension_b
       , itm.extension_c as extension_c
       , itm.extension_d as extension_d
       , itm.extension_e as extension_e
       , itm.extension_f as extension_f
       , itm.extension_g as extension_g
       , itm.extension_h as extension_h
       , itm.extension_i as extension_i
       , itm.extension_j as extension_j
       , itm.entry_ts
       , itm.entry_user_cd
       , itm.renew_cnt
       , itm.renew_ts
       , itm.renew_user_cd
      from ( select
               dept.company_cd
             , itm.item_id
             , itm.item_type_cd
             , itm.locale_id
             , typ.item_type_name
             , itm.item_cd
             , itm.item_name
             , itm.sort_key
             , itm.allow_del_flag
             , typ.extension_a type_extension_a
             , typ.extension_b type_extension_b
             , typ.extension_c type_extension_c
             , typ.extension_d type_extension_d
             , typ.extension_e type_extension_e
             , typ.extension_f type_extension_f
             , typ.extension_g type_extension_g
             , typ.extension_h type_extension_h
             , typ.extension_i type_extension_i
             , typ.extension_j type_extension_j
             , itm.extension_a
             , itm.extension_b
             , itm.extension_c
             , itm.extension_d
             , itm.extension_e
             , itm.extension_f
             , itm.extension_g
             , itm.extension_h
             , itm.extension_i
             , itm.extension_j
             , itm.entry_ts
             , itm.entry_user_cd
             , itm.renew_cnt
             , itm.renew_ts
             , itm.renew_user_cd
           from (select distinct
                     w.company_cd
                   , w.locale_id
                 from imm_department w
                 where 
                     w.company_cd = w.department_set_cd
                 and w.company_cd = w.department_cd
                ) dept
           inner join k10c_item_type typ
              on dept.locale_id = typ.locale_id
           inner join k10c_item itm
              on typ.item_type_cd = itm.item_type_cd
             and typ.locale_id = itm.locale_id
     ) itm
     where
        not exists (
          select '1' from k10c_item_company itm_cmp
          where itm.company_cd = itm_cmp.company_cd
            and itm.item_id = itm_cmp.item_id
            and itm.locale_id = itm_cmp.locale_id
        )
     union all
     select
         itm_cmp.company_cd as company_cd
       , itm_cmp.item_id as item_id
       , itm_cmp.locale_id as locale_id
       , itm_cmp.item_type_cd as item_type_cd
       , itm_cmp.item_cd as company_item_cd
       , itm_cmp.item_cd as item_cd
       , itm_cmp.item_name as item_name
       , itm_cmp.sort_key as sort_key
       , itm.allow_del_flag as allow_del_flag
       , itm_cmp.delete_flag as delete_flag
       , coalesce(itm_cmp.extension_a, itm.extension_a) as extension_a
       , coalesce(itm_cmp.extension_b, itm.extension_b) as extension_b
       , coalesce(itm_cmp.extension_c, itm.extension_c) as extension_c
       , coalesce(itm_cmp.extension_d, itm.extension_d) as extension_d
       , coalesce(itm_cmp.extension_e, itm.extension_e) as extension_e
       , coalesce(itm_cmp.extension_f, itm.extension_f) as extension_f
       , coalesce(itm_cmp.extension_g, itm.extension_g) as extension_g
       , coalesce(itm_cmp.extension_h, itm.extension_h) as extension_h
       , coalesce(itm_cmp.extension_i, itm.extension_i) as extension_i
       , coalesce(itm_cmp.extension_j, itm.extension_j) as extension_j
       , itm_cmp.entry_ts
       , itm_cmp.entry_user_cd
       , itm_cmp.renew_cnt
       , itm_cmp.renew_ts
       , itm_cmp.renew_user_cd
     from k10c_item_company itm_cmp
     left join k10c_item itm
       on itm_cmp.item_id = itm.item_id
       and itm_cmp.locale_id = itm.locale_id
   ) itm_full
     left outer join k10c_item_type typ
        on itm_full.item_type_cd = typ.item_type_cd
       and itm_full.locale_id = typ.locale_id
;
---------------------------------------


・Oracle Database
---------------------------------------
create or replace view k10v_citem
as
select
      itm_full.company_cd
    , itm_full.item_id
    , itm_full.locale_id
    , itm_full.item_type_cd
    , typ.item_type_name
    , itm_full.company_item_cd
    , itm_full.item_cd
    , itm_full.item_name
    , itm_full.sort_key
    , itm_full.allow_del_flag
    , itm_full.delete_flag
    , typ.extension_a as type_extension_a
    , typ.extension_b as type_extension_b
    , typ.extension_c as type_extension_c
    , typ.extension_d as type_extension_d
    , typ.extension_e as type_extension_e
    , typ.extension_f as type_extension_f
    , typ.extension_g as type_extension_g
    , typ.extension_h as type_extension_h
    , typ.extension_i as type_extension_i
    , typ.extension_j as type_extension_j
    , itm_full.extension_a
    , itm_full.extension_b
    , itm_full.extension_c
    , itm_full.extension_d
    , itm_full.extension_e
    , itm_full.extension_f
    , itm_full.extension_g
    , itm_full.extension_h
    , itm_full.extension_i
    , itm_full.extension_j
    , itm_full.entry_ts
    , itm_full.entry_user_cd
    , itm_full.renew_cnt
    , itm_full.renew_ts
    , itm_full.renew_user_cd
from (select
         itm.company_cd as company_cd
       , itm.item_id as item_id
       , itm.locale_id as locale_id
       , itm.item_type_cd as item_type_cd
       , cast(null as varchar2(10)) as company_item_cd
       , itm.item_cd as item_cd
       , itm.item_name as item_name
       , itm.sort_key as sort_key
       , itm.allow_del_flag as allow_del_flag
       , '0' as delete_flag
       , itm.extension_a as extension_a
       , itm.extension_b as extension_b
       , itm.extension_c as extension_c
       , itm.extension_d as extension_d
       , itm.extension_e as extension_e
       , itm.extension_f as extension_f
       , itm.extension_g as extension_g
       , itm.extension_h as extension_h
       , itm.extension_i as extension_i
       , itm.extension_j as extension_j
       , itm.entry_ts
       , itm.entry_user_cd
       , itm.renew_cnt
       , itm.renew_ts
       , itm.renew_user_cd
      from ( select
               dept.company_cd
             , itm.item_id
             , itm.item_type_cd
             , itm.locale_id
             , typ.item_type_name
             , itm.item_cd
             , itm.item_name
             , itm.sort_key
             , itm.allow_del_flag
             , typ.extension_a type_extension_a
             , typ.extension_b type_extension_b
             , typ.extension_c type_extension_c
             , typ.extension_d type_extension_d
             , typ.extension_e type_extension_e
             , typ.extension_f type_extension_f
             , typ.extension_g type_extension_g
             , typ.extension_h type_extension_h
             , typ.extension_i type_extension_i
             , typ.extension_j type_extension_j
             , itm.extension_a
             , itm.extension_b
             , itm.extension_c
             , itm.extension_d
             , itm.extension_e
             , itm.extension_f
             , itm.extension_g
             , itm.extension_h
             , itm.extension_i
             , itm.extension_j
             , itm.entry_ts
             , itm.entry_user_cd
             , itm.renew_cnt
             , itm.renew_ts
             , itm.renew_user_cd
           from (select distinct
                     w.company_cd
                   , w.locale_id
                 from imm_department w
                 where 
                     w.company_cd = w.department_set_cd
                 and w.company_cd = w.department_cd
                ) dept
           inner join k10c_item_type typ
              on dept.locale_id = typ.locale_id
           inner join k10c_item itm
              on typ.item_type_cd = itm.item_type_cd
             and typ.locale_id = itm.locale_id
     ) itm
     where
        not exists (
          select '1' from k10c_item_company itm_cmp
          where itm.company_cd = itm_cmp.company_cd
            and itm.item_id = itm_cmp.item_id
            and itm.locale_id = itm_cmp.locale_id
        )
     union all
     select
         itm_cmp.company_cd as company_cd
       , itm_cmp.item_id as item_id
       , itm_cmp.locale_id as locale_id
       , itm_cmp.item_type_cd as item_type_cd
       , itm_cmp.item_cd as company_item_cd
       , itm_cmp.item_cd as item_cd
       , itm_cmp.item_name as item_name
       , itm_cmp.sort_key as sort_key
       , itm.allow_del_flag as allow_del_flag
       , itm_cmp.delete_flag as delete_flag
       , coalesce(itm_cmp.extension_a, itm.extension_a) as extension_a
       , coalesce(itm_cmp.extension_b, itm.extension_b) as extension_b
       , coalesce(itm_cmp.extension_c, itm.extension_c) as extension_c
       , coalesce(itm_cmp.extension_d, itm.extension_d) as extension_d
       , coalesce(itm_cmp.extension_e, itm.extension_e) as extension_e
       , coalesce(itm_cmp.extension_f, itm.extension_f) as extension_f
       , coalesce(itm_cmp.extension_g, itm.extension_g) as extension_g
       , coalesce(itm_cmp.extension_h, itm.extension_h) as extension_h
       , coalesce(itm_cmp.extension_i, itm.extension_i) as extension_i
       , coalesce(itm_cmp.extension_j, itm.extension_j) as extension_j
       , itm_cmp.entry_ts
       , itm_cmp.entry_user_cd
       , itm_cmp.renew_cnt
       , itm_cmp.renew_ts
       , itm_cmp.renew_user_cd
     from k10c_item_company itm_cmp
     left join k10c_item itm
       on itm_cmp.item_id = itm.item_id
       and itm_cmp.locale_id = itm.locale_id
   ) itm_full
     left outer join k10c_item_type typ
        on itm_full.item_type_cd = typ.item_type_cd
       and itm_full.locale_id = typ.locale_id
;
---------------------------------------



・Microsoft SQL Server
---------------------------------------
drop view k10v_citem;

create view k10v_citem
as
select
      itm_full.company_cd
    , itm_full.item_id
    , itm_full.locale_id
    , itm_full.item_type_cd
    , typ.item_type_name
    , itm_full.company_item_cd
    , itm_full.item_cd
    , itm_full.item_name
    , itm_full.sort_key
    , itm_full.allow_del_flag
    , itm_full.delete_flag
    , typ.extension_a as type_extension_a
    , typ.extension_b as type_extension_b
    , typ.extension_c as type_extension_c
    , typ.extension_d as type_extension_d
    , typ.extension_e as type_extension_e
    , typ.extension_f as type_extension_f
    , typ.extension_g as type_extension_g
    , typ.extension_h as type_extension_h
    , typ.extension_i as type_extension_i
    , typ.extension_j as type_extension_j
    , itm_full.extension_a
    , itm_full.extension_b
    , itm_full.extension_c
    , itm_full.extension_d
    , itm_full.extension_e
    , itm_full.extension_f
    , itm_full.extension_g
    , itm_full.extension_h
    , itm_full.extension_i
    , itm_full.extension_j
    , itm_full.entry_ts
    , itm_full.entry_user_cd
    , itm_full.renew_cnt
    , itm_full.renew_ts
    , itm_full.renew_user_cd
from (select
         itm.company_cd as company_cd
       , itm.item_id as item_id
       , itm.locale_id as locale_id
       , itm.item_type_cd as item_type_cd
       , cast(null as nvarchar(10)) as company_item_cd
       , itm.item_cd as item_cd
       , itm.item_name as item_name
       , itm.sort_key as sort_key
       , itm.allow_del_flag as allow_del_flag
       , '0' as delete_flag
       , itm.extension_a as extension_a
       , itm.extension_b as extension_b
       , itm.extension_c as extension_c
       , itm.extension_d as extension_d
       , itm.extension_e as extension_e
       , itm.extension_f as extension_f
       , itm.extension_g as extension_g
       , itm.extension_h as extension_h
       , itm.extension_i as extension_i
       , itm.extension_j as extension_j
       , itm.entry_ts
       , itm.entry_user_cd
       , itm.renew_cnt
       , itm.renew_ts
       , itm.renew_user_cd
      from ( select
               dept.company_cd
             , itm.item_id
             , itm.item_type_cd
             , itm.locale_id
             , typ.item_type_name
             , itm.item_cd
             , itm.item_name
             , itm.sort_key
             , itm.allow_del_flag
             , typ.extension_a type_extension_a
             , typ.extension_b type_extension_b
             , typ.extension_c type_extension_c
             , typ.extension_d type_extension_d
             , typ.extension_e type_extension_e
             , typ.extension_f type_extension_f
             , typ.extension_g type_extension_g
             , typ.extension_h type_extension_h
             , typ.extension_i type_extension_i
             , typ.extension_j type_extension_j
             , itm.extension_a
             , itm.extension_b
             , itm.extension_c
             , itm.extension_d
             , itm.extension_e
             , itm.extension_f
             , itm.extension_g
             , itm.extension_h
             , itm.extension_i
             , itm.extension_j
             , itm.entry_ts
             , itm.entry_user_cd
             , itm.renew_cnt
             , itm.renew_ts
             , itm.renew_user_cd
           from (select distinct
                     w.company_cd
                   , w.locale_id
                 from imm_department w
                 where 
                     w.company_cd = w.department_set_cd
                 and w.company_cd = w.department_cd
                ) dept
           inner join k10c_item_type typ
              on dept.locale_id = typ.locale_id
           inner join k10c_item itm
              on typ.item_type_cd = itm.item_type_cd
             and typ.locale_id = itm.locale_id
     ) itm
     where
        not exists (
          select '1' from k10c_item_company itm_cmp
          where itm.company_cd = itm_cmp.company_cd
            and itm.item_id = itm_cmp.item_id
            and itm.locale_id = itm_cmp.locale_id
        )
     union all
     select
         itm_cmp.company_cd as company_cd
       , itm_cmp.item_id as item_id
       , itm_cmp.locale_id as locale_id
       , itm_cmp.item_type_cd as item_type_cd
       , itm_cmp.item_cd as company_item_cd
       , itm_cmp.item_cd as item_cd
       , itm_cmp.item_name as item_name
       , itm_cmp.sort_key as sort_key
       , itm.allow_del_flag as allow_del_flag
       , itm_cmp.delete_flag as delete_flag
       , coalesce(itm_cmp.extension_a, itm.extension_a) as extension_a
       , coalesce(itm_cmp.extension_b, itm.extension_b) as extension_b
       , coalesce(itm_cmp.extension_c, itm.extension_c) as extension_c
       , coalesce(itm_cmp.extension_d, itm.extension_d) as extension_d
       , coalesce(itm_cmp.extension_e, itm.extension_e) as extension_e
       , coalesce(itm_cmp.extension_f, itm.extension_f) as extension_f
       , coalesce(itm_cmp.extension_g, itm.extension_g) as extension_g
       , coalesce(itm_cmp.extension_h, itm.extension_h) as extension_h
       , coalesce(itm_cmp.extension_i, itm.extension_i) as extension_i
       , coalesce(itm_cmp.extension_j, itm.extension_j) as extension_j
       , itm_cmp.entry_ts
       , itm_cmp.entry_user_cd
       , itm_cmp.renew_cnt
       , itm_cmp.renew_ts
       , itm_cmp.renew_user_cd
     from k10c_item_company itm_cmp
     left join k10c_item itm
       on itm_cmp.item_id = itm.item_id
       and itm_cmp.locale_id = itm.locale_id
   ) itm_full
     left outer join k10c_item_type typ
        on itm_full.item_type_cd = typ.item_type_cd
       and itm_full.locale_id = typ.locale_id
;
---------------------------------------


-- 対象 -------------------------------------------------------------------------
iAP/Accel Applications/Accel Kaiden! 基盤モジュール/2.0.0~2.0.12、2.0.13、2.0.13-PATCH_001
 --------------------------------------------------------------------------------



FAQID:1269
この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています
Powered by Zendesk