X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5E5B79DCAB4 for ; Thu, 1 Dec 2005 23:27:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52593-02 for ; Thu, 1 Dec 2005 23:27:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc12.comcast.net (rwcrmhc14.comcast.net [216.148.227.89]) by postgresql.org (Postfix) with ESMTP id E2C049DD6ED for ; Thu, 1 Dec 2005 23:27:03 -0400 (AST) Received: from dell8200 (pcp09613107pcs.rte20201.de.comcast.net[68.82.197.68]) by comcast.net (rwcrmhc14) with SMTP id <2005120203270001400qb7vee>; Fri, 2 Dec 2005 03:27:01 +0000 From: "Rick Schumeyer" To: "'Luke Lonergan'" , Subject: Re: COPY into table too slow with index: now an I/O question Date: Thu, 1 Dec 2005 22:26:56 -0500 Message-ID: <00ee01c5f6f0$3faec750$0200a8c0@dell8200> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/49 X-Sequence-Number: 15870 I only have one CPU. Is my copy of iostat confused, or does this have something to do with hyperthreading or dual core? (AFAIK, I don't have = a dual core!) The problem (for me) with dropping the index during a copy is that it = takes tens of minutes (or more) to recreate the geometry index once the table = has, say, 50 million rows. > -----Original Message----- > From: Luke Lonergan [mailto:llonergan@greenplum.com] > Sent: Thursday, December 01, 2005 9:27 PM > To: Rick Schumeyer; pgsql-performance@postgresql.org > Subject: Re: [PERFORM] COPY into table too slow with index: now an I/O > question >=20 > Rick, >=20 > On 12/1/05 2:18 PM, "Rick Schumeyer" wrote: >=20 > > As a follow up to my own question: > > > > I reran the COPY both ways (with the index and without) while = running > iostat. > > The following values > > are averages: > > %user %nice %sys %iowait %idle > > no index 39 0 2.8 11 47 > > index 16 1.5 2.1 34 46 > > > > I=B9m no performance guru, so please indulge a couple of silly = questions: > > > > 1) Why is there so much idle time? I would think the CPU would > either be > > busy or waiting for IO. >=20 > The 100% represents 2 CPUs. When one CPU is fully busy you should see = 50% > idle time. >=20 > > 2) It seems that I need to improve my disk situation. Would it > help to > > add another drive to my PC and > > keep the input data on a separate drive from my pg tables? If so, = some > > pointers on the best way to set that up > > would be appreciated. >=20 > Putting the index and the table on separate disks will fix this IMO. = I > think you can do that using the "TABLESPACE" concept for each. >=20 > The problem I see is nicely shown by the increase in IOWAIT between = the > two > patterns (with and without index). It seems likely that the pattern = is: > A - insert a tuple into the table > B - insert an entry into the index > C - fsync the WAL > - repeat >=20 > This can be as bad as having a disk seek to access the table data = every > time > the 8KB page boundary is crossed, then again for the index, then again = for > the WAL, and random disk seeks happen only as fast as about 10ms, so = you > can > only do those at a rate of 100/s. >=20 > > Please let me know if anyone has additional ideas. >=20 > This is a fairly common problem, some people drop the index, load the > data, > then recreate the index to get around it. >=20 > - Luke