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 12BBB52A9C for ; Tue, 19 Jul 2005 17:29:06 -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 56500-03 for ; Tue, 19 Jul 2005 20:29:01 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by svr1.postgresql.org (Postfix) with ESMTP id B54D852A88 for ; Tue, 19 Jul 2005 17:29:00 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id i6so1314855wra for ; Tue, 19 Jul 2005 13:29:02 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Xjq5mhzWZC3giOSDqH65tB7g4ue5ro9+tdul5/z81YAedYs2Y196iVqVGGKY5b4XgV56YBSN1ew1SmTtv69KijBsF/FgATPkrGOmmkTcDPdYYGLo5v7OXrUEHv053cGvvHbToFt+0vkCUXltcGdYOZg3HKQL6ZB//RC5znbxlrg= Received: by 10.54.61.14 with SMTP id j14mr881742wra; Tue, 19 Jul 2005 13:28:26 -0700 (PDT) Received: by 10.54.150.2 with HTTP; Tue, 19 Jul 2005 13:28:26 -0700 (PDT) Message-ID: <1efd553a050719132836c31b78@mail.gmail.com> Date: Tue, 19 Jul 2005 16:28:26 -0400 From: Oliver Crosby Reply-To: Oliver Crosby To: Dawid Kuroczko Subject: Re: Looking for tips Cc: Kevin Grittner , jd@commandprompt.com, pgsql-performance@postgresql.org In-Reply-To: <758d5e7f0507191319636afaa3@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1efd553a0507191308219a098b@mail.gmail.com> <758d5e7f0507191319636afaa3@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.066 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200507/324 X-Sequence-Number: 13565 > If it is possible try: > 1) wrapping many inserts into one transaction > (BEGIN;INSERT;INSERT;...INSERT;COMMIT;). As PostgreSQL will need to > handle less transactions per second (each your insert is a transaction), = it > may work faster. Aye, that's what I have it doing right now. The transactions do save a HUGE chunk of time. (Cuts it down by about 40%). > 2) If you can do 1, you could go further and use a COPY command which is > the fastest way to bulk-load a database. I don't think I can use COPY in my case because I need to do processing on a per-line basis, and I need to check if the item I want to insert is already there, and if it is, I need to get it's ID so I can use that for further processing.