X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3176F329F06 for ; Thu, 16 Sep 2004 11:39:20 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53467-01 for ; Thu, 16 Sep 2004 10:39:06 +0000 (GMT) Received: from mail.logi-track.com (www.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id B6395329C65 for ; Thu, 16 Sep 2004 11:39:07 +0100 (BST) Received: from kingfisher.intern.logi-track.com (p5088EAFC.dip0.t-ipconnect.de [80.136.234.252]) by mail.logi-track.com (Postfix) with ESMTP id D6268305A0; Thu, 16 Sep 2004 12:39:08 +0200 (CEST) Received: from kingfisher.intern.logi-track.com (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with SMTP id 7A846AB2F3; Thu, 16 Sep 2004 12:39:04 +0200 (CEST) Date: Thu, 16 Sep 2004 12:39:04 +0200 From: Markus Schaber To: ischamay.andbergsay@activestateway.com Cc: pgsql-performance@postgresql.org Subject: Re: Data Warehouse Reevaluation - MySQL vs Postgres -- Message-ID: <20040916123904.3ddb8cd6@kingfisher.intern.logi-track.com> In-Reply-To: References: <20040912042442.49915.qmail@web41508.mail.yahoo.com> <20040914141452.002e5d4e@kingfisher.intern.logi-track.com> <20040914143303.GR21419@ns.snowman.net> Organization: logi-track ag, =?ISO-8859-15?Q?z=FCrich?= X-Mailer: Sylpheed-Claws 0.9.12a (GTK+ 1.2.10; i386-pc-linux-gnu) X-Face: Nx5T&>Nj$VrVPv}sC3IL&)TqHHOKCz/|)R$i"*r@w0{*I6w; UNU_hdl1J4NI_m{IMztq=>cmM}1gCLbAF+9\#CGkG8}Y{x%SuQ>1#t:; Z(|\qdd[i]HStki~#w1$TPF}:0w-7"S\Ev|_a$K wrote: > Googling 'upsert' (an Oraclism, I believe) will get you hits on Oracle=20 > and DB2's implementation of MERGE, which does what AMOUNTS to what is > described below (one mass UPDATE...FROM, one mass INSERT...WHERE NOT=20 > EXISTS). >=20 > No, you shouldn't iterate row-by-row through the temp table. > Whenever possible, try to do updates in one single (mass) operation. > Doing it that way gives the optimizer the best chance at amortizing > fixed costs, and batching operations. But when every updated row has a different value for the column(s) to be updated, then I still have to use one update statement per row, which I expect to be faster when done via a stored procedure than having the whole client-server roundtrip including parsing every time. Or did I miss some nice SQL statement? Have a nice day, Markus --=20 markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z=FCrich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com