私はかなりパフォーマンスの悪いクエリ(継承した)を持っており、それを最適化する方法がよくわかりません...私が理解している限り、2番目の列の値を1番目の列の値に加えてからの値として設定していますリレーションシップが見つかった別のテーブル。
update table1 set
col2 = col1 || coalesce ((
select table2.the_column_wanted from table2 where table2.fk = table1.pk and
table2.flag = 'Y'))
where flag = 'Y' and pk in ( select distinct fk from table2 );