I am trying to update the table with a result from select query. The problem is that query takes too long and i get an error that log file is not enough. For example:
With cte as (
select t1.key, t1.col1, t2.col2, t3.col3
from t1
left join t2 on t1.key = t2.key
left join t3 on t1.ket = t3.key
)
UPDATE t4
SET t4.col1 = cte.col1
t4.col2 = cte.col2
t4.col3 = cte.col3
from cte
where
t4.key = cte.key
Right now i am updating the table by parts (just change the end of the query to
where
t4.key < 10000000
t4.key = cte.key
). Is there any way to optimize it and make queries faster?