X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 54F60D91FA for ; Sat, 24 Sep 2005 18:15:41 -0300 (ADT) 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 71750-07 for ; Sat, 24 Sep 2005 21:15:38 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8CC72D8EF1 for ; Sat, 24 Sep 2005 18:15:39 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j8OLFfpK023703; Sat, 24 Sep 2005 17:15:41 -0400 (EDT) To: Ron Mayer Cc: pgsql-performance@postgresql.org Subject: Re: Multiple insert performance trick or performance misunderstanding? In-reply-to: References: Comments: In-reply-to Ron Mayer message dated "Sat, 24 Sep 2005 13:51:16 -0700" Date: Sat, 24 Sep 2005 17:15:41 -0400 Message-ID: <23702.1127596541@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200509/328 X-Sequence-Number: 14636 Ron Mayer writes: > Is it expected that I'd be better off sending big > concatenated strings like > "insert into tbl (c1,c2) values (v1,v2);insert into tbl (c1,c2) values (v3,v4);..." > instead of sending them one at a time? It's certainly possible, if the network round trip from client to server is slow. I do not think offhand that there is any material advantage for the processing within the server (assuming you've wrapped the whole thing into one transaction in both cases); if anything, the concatenated-statement case is probably a bit worse inside the server because it will transiently eat more memory. But network latency or client-side per-command overhead could well cause the results you see. regards, tom lane