Jerome Raupach <jraupach@intelcom.fr> writes:
> I have a big problem of performance, please help me.
You could code the update so it only evaluates the view once,
rather than twice per table2 row as you now have it:
UPDATE table2 SETnb=table2.nb+view1.nb,time=table2.time+view1.time
FROM view1
WHERE view1.f1=table2.f1 and view1.date=table2.date;
Subselects are nice, but they're not cheap. Joins are faster.
The view itself also seems to be pretty inefficiently coded,
although I'm not sure you can do much better given that GROUP BY
doesn't really work in views right now. Hopefully by 7.2 there
will be a better way to do the view.
regards, tom lane