Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.10.1/8.10.1) with ESMTP id e7TEtgC18160 for ; Tue, 29 Aug 2000 10:55:42 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id KAA01767; Tue, 29 Aug 2000 10:55:34 -0400 (EDT) To: Jerome Raupach cc: pgsql-sql@postgresql.org Subject: Re: performance on insert/update In-reply-to: <39ABA7F2.6180FFC7@intelcom.fr> References: <39ABA7F2.6180FFC7@intelcom.fr> Comments: In-reply-to Jerome Raupach message dated "Tue, 29 Aug 2000 14:09:22 +0200" Date: Tue, 29 Aug 2000 10:55:34 -0400 Message-ID: <1764.967560934@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200008/324 Jerome Raupach 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 SET nb=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