我正在寻找PostgreSQL中的优化方法:
update table1
set (a,b)=(somecomplexfunction(table1.something),2*somecomplexfunction(table1.something))
where ...
这会计算somecomplexfunction(table1.something)两次,我想做类似的事情:
update table1 set (a,b)=somecomplexvectorfunction(table1.something) where ...
但更新语法不支持多个字段功能。有什么想法吗?
答案 0 :(得分:1)
update table1
set
a = somecomplexfunction(table1.something),
b = a * 2
where ...