SQL Merge Where子句

时间:2016-11-01 08:52:16

标签: sql oracle optimization merge

之间有什么区别:

merge INTO cdm.ma_participant part 
  USING MA_USER.D_CONT_METR_01_00_25_52 metr 
  ON (part.participant_id=metr.participant_id AND metr.main_prior > 1)
WHEN matched THEN
  UPDATE
  SET part.DEACTIVATED_FLG      = 'Y',
    part.DEACTIVATION_REASON_CD = 8,
    part.DEACTIVATION_DTTM      = sysdate,
    part.DEACTIVATION_ACTION_ID = 68215;

merge INTO cdm.ma_participant part 
  USING (SELECT * FROM MA_USER.D_CONT_METR_01_00_25_52 WHERE main_prior > 1) metr 
  ON (part.participant_id=metr.participant_id)
WHEN matched THEN
  UPDATE
  SET part.DEACTIVATED_FLG      = 'Y',
    part.DEACTIVATION_REASON_CD = 8,
    part.DEACTIVATION_DTTM      = sysdate,
    part.DEACTIVATION_ACTION_ID = 68215;

我想找出最佳的优化变体。第一个大约需要30分钟。

0 个答案:

没有答案