Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 0B332633700 for ; Tue, 20 Apr 2010 15:24:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 69562-01 for ; Tue, 20 Apr 2010 18:23:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gw0-f46.google.com (mail-gw0-f46.google.com [74.125.83.46]) by mail.postgresql.org (Postfix) with ESMTP id 2FBD463326C for ; Tue, 20 Apr 2010 15:23:54 -0300 (ADT) Received: by gwj19 with SMTP id 19so938950gwj.19 for ; Tue, 20 Apr 2010 11:23:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=MTUl1vIJ6Wpc+fD/7/uCWebZCkg2eUMUPpCdcuuHkzE=; b=ulMnUuvCN1SuFe3bYfY7G33XY4D2Cv1DkzezKMU841cUK2dneqvZkoiJhd3IKuIwNs k+kokH988sMfNADgpeQbHlkdKkocKEtDGnss+BlrYTuVLtrurU1wIrh3Y3Ywc+lq/gBy nzqGYQB9iFVJtR0vC/is6T2gA7Q0d9C6vXL7o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=BI0OBYDvVNDYKal9WpnkEj1MSD+krdFwx2GORwDmzwhLIWOaujPxsayev9ctoY1HOL RVGpIADr/6ZU1+DouScd1BzvHZMTUWa372jWk/EYk96aRqTrvk/9DVlD/Bv/ZQFgqbw6 VV23Zs5Pc9kI+3ElOgPuumsE/m9QSTLlbdxm0= MIME-Version: 1.0 Received: by 10.150.218.9 with HTTP; Tue, 20 Apr 2010 11:23:51 -0700 (PDT) In-Reply-To: <20100420182030.GA53489@mr-paradox.net> References: <20100420173936.GA50886@mr-paradox.net> <20100420180351.GA51940@mr-paradox.net> <20100420182030.GA53489@mr-paradox.net> Date: Tue, 20 Apr 2010 12:23:51 -0600 Received: by 10.150.209.16 with SMTP id h16mr7604182ybg.268.1271787831748; Tue, 20 Apr 2010 11:23:51 -0700 (PDT) Message-ID: Subject: Re: Very high effective_cache_size == worse performance? From: Scott Marlowe To: David Kerr Cc: Nikolas Everett , Robert Haas , pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.967 tagged_above=-10 required=5 tests=AWL=-0.067, BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201004/252 X-Sequence-Number: 38502 On Tue, Apr 20, 2010 at 12:20 PM, David Kerr wrote: > On Tue, Apr 20, 2010 at 02:12:15PM -0400, Nikolas Everett wrote: > - On Tue, Apr 20, 2010 at 2:03 PM, David Kerr wrote: > - > - > that thought occured to me while I was testing this. I ran a vacuumdb= -z > - > on my database during the load and it didn't impact performance at al= l. > - > > - > Incidentally the code is written to work like this : > - > > - > while (read X lines in file){ > - > Process those lines. > - > write lines to DB. > - > } > - > > - > So i would generally expect to get the benefits of the updated static= is > - > once the loop ended. no? =A0(would prepared statements affect that po= ssibly?) > - > > - > Also, while I was debugging the problem, I did load a 2nd file into t= he DB > - > ontop of one that had been loaded. So the statistics almost certinaly > - > should > - > have been decent at that point. > - > > - > I did turn on log_min_duration_statement but that caused performance = to be > - > unbearable, > - > but i could turn it on again if it would help. > - > > - > Dave > - > - > - You can absolutely use copy if you like but you need to use a non-stand= ard > - jdbc driver: =A0kato.iki.fi/sw/db/postgresql/jdbc/copy/. =A0I've used i= t in the > - past and it worked. > - > - Is the whole thing going in in one transaction? =A0I'm reasonably sure > - statistics aren't kept for uncommited transactions. > - > - For inserts the prepared statements can only help. =A0For selects they = can > - hurt because eventually the JDBC driver will turn them into back end > - prepared statements that are only planned once. =A0The price here is th= at that > - plan may not be the best plan for the data that you throw at it. > - > - What was log_min_duration_statement logging that it killed performance? > - > - --Nik > > Good to know about the jdbc-copy. but this is a huge project and the load= is > just one very very tiny component, I don't think we could introduce anyth= ing > new to assist that. > > It's not all in one tx. I don't have visibility to the code to determine = how > it's broken down, but most likely each while loop is a tx. > > I set it to log all statements (i.e., =3D 0.). that doubled the load time= from > ~15 to ~30 hours. I could, of course, be more granular if it would be hel= pful. So are you logging to the same drive that has pg_xlog and your data/base directory on this machine?