Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 0309B1337B43 for ; Mon, 18 Apr 2011 02:19:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 32800-01 for ; Mon, 18 Apr 2011 05:19:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iy0-f174.google.com (mail-iy0-f174.google.com [209.85.210.174]) by mail.postgresql.org (Postfix) with ESMTP id A03C713364DE for ; Mon, 18 Apr 2011 02:19:04 -0300 (ADT) Received: by iyb14 with SMTP id 14so3607629iyb.19 for ; Sun, 17 Apr 2011 22:19:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=c7KdOzDa9VQm7AZhGKxRZNBHW3RxmfepT5yi9LOXyWY=; b=dZI0mYV4nIySdTQcLU0DBLSUQ6sw9YYyCzgCjbp6cRKsYRUVI9O1N/anesi7XGqXTH EXYbzSdyOL+9N2jwBvjM9SVeBOkjFF6a/PH2khTIPuU8sMryZyECQRkKoWJMZo0p0hRX tAPB/fwwisR845jwoS6jzd4HhnkjyUszVg0xY= 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=dH0ZmlBuIon+NdA7Sf4x5dUliAIr4O+/vScFzq4orBpLSpMoGXigju+qhr1IDWpURI +M1YhLwg/O6lddgeyyhi0pmL5flSXkNcF0PqVD752ppsfiaYtv0AmffB82adDYp9Z2pb 8W+qqGaWMjKmX1s6JAQwNny6cl0A6JklfgsfU= MIME-Version: 1.0 Received: by 10.42.132.65 with SMTP id c1mr5751865ict.513.1303103944002; Sun, 17 Apr 2011 22:19:04 -0700 (PDT) Received: by 10.42.226.68 with HTTP; Sun, 17 Apr 2011 22:19:03 -0700 (PDT) In-Reply-To: References: Date: Mon, 18 Apr 2011 13:19:03 +0800 Message-ID: Subject: Re: REINDEX takes half a day (and still not complete!) From: Phoenix Kiula To: Scott Marlowe Cc: Merlin Moncure , 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.897 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, NORMAL_HTTP_TO_IP=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201104/236 X-Sequence-Number: 43298 Btw, hardware is not an issue. My db has been working fine for a while. Smaller poorer systems around the web run InnoDB databases. I wouldn't touch that with a barge pole. I have a hardware RAID controller, not "fake". It's a good quality battery-backed 3Ware: http://192.19.193.26/products/serial_ata2-9000.asp On Mon, Apr 18, 2011 at 1:14 PM, Phoenix Kiula wr= ote: > Thanks for these suggestions. > > I am beginning to wonder if the issue is deeper. > > I set autovacuum to off, then turned off all the connections to the > database, and did a manual vacuum just to see how long it takes. > > This was last night my time. I woke up this morning and it has still > not finished. > > The maintenance_men given to the DB for this process was 2GB. > > There is nothing else going on on the server! Now, even REINDEX is > just failing in the middle: > > > # REINDEX INDEX new_idx_userid; > server closed the connection unexpectedly > =A0 =A0 =A0 =A0This probably means the server terminated abnormally > =A0 =A0 =A0 =A0before or while processing the request. > The connection to the server was lost. Attempting reset: Failed. > > > What else could be wrong? > > > > > On Mon, Apr 18, 2011 at 2:38 AM, Scott Marlowe = wrote: >> On Sun, Apr 17, 2011 at 10:59 AM, Phoenix wrot= e: >>> TOP does not show much beyond "postmaster". How should I use TOP and >>> what info can I give you? This is what it looks like: >> >> We're basically looking to see if the postmaster process doing the >> vacuuming or reindexing is stuck in a D state, which means it's >> waiting on IO. >> hot the c key while it's running and you should get a little more info >> on which processes are what. >> >>> =A04799 postgres =A015 =A0 0 =A0532m =A094m =A093m D =A00.7 =A01.2 =A0 = 0:00.14 >>> postmaster >> >> That is likely the postmaster that is waiting on IO. >> >>> VMSTAT 10 shows this: >>> >>> =A0r =A0b =A0 swpd =A0 free =A0 buff =A0cache =A0 si =A0 so =A0 =A0bi = =A0 =A0bo =A0 in =A0 =A0cs us sy id wa >>> =A03 14 =A099552 =A017900 =A041108 7201712 =A0 =A00 =A0 =A00 =A0 =A042 = =A0 =A011 =A0 =A00 =A0 =A0 0 =A08 34 41 16 >>> =A02 17 =A099552 =A016468 =A041628 7203012 =A0 =A00 =A0 =A00 =A01326 = =A0 =A084 1437 154810 =A07 66 12 15 >>> =A03 =A07 =A099476 =A016796 =A041056 7198976 =A0 =A00 =A0 =A00 =A01398 = =A0 =A096 1453 156211 =A07 66 21 =A06 >>> =A03 17 =A099476 =A017228 =A039132 7177240 =A0 =A00 =A0 =A00 =A01325 = =A0 =A068 1529 156111 =A08 65 16 11 >> >> So, we're at 11 to 15% io wait. =A0I'm gonna guess you have 8 cores / >> threads in your CPUs, and 1/8th ot 100% is 12% so looks like you're >> probably IO bound here. =A0iostat tells us more: >> >>> The results of "iostat -xd 10" is: >>> Device: =A0 =A0rrqm/s wrqm/s =A0 r/s =A0 w/s =A0rsec/s =A0wsec/s =A0 = =A0rkB/s =A0 =A0wkB/s >>> avgrq-sz avgqu-sz =A0 await =A0svctm =A0%util >>> sda =A0 =A0 =A0 =A0 =A00.00 =A0 7.41 =A00.30 =A03.50 =A0 =A02.40 =A0 87= .29 =A0 =A0 1.20 =A0 =A043.64 >>> =A0 23.58 =A0 =A0 0.13 =A0 32.92 =A010.03 =A0 3.81 >>> sdb =A0 =A0 =A0 =A0 =A00.00 =A0 0.00 =A00.00 =A00.00 =A0 =A00.00 =A0 = =A00.00 =A0 =A0 0.00 =A0 =A0 0.00 >>> =A0 =A00.00 =A0 =A0 0.00 =A0 =A00.00 =A0 0.00 =A0 0.00 >>> sdc =A0 =A0 =A0 =A0 =A00.00 =A018.32 158.26 =A04.10 2519.32 =A0180.98 = =A01259.66 >>> 90.49 =A0 =A016.63 =A0 =A013.04 =A0 79.91 =A0 6.17 100.11 >> >> 100% IO utilization, so yea, it's likely that your sdc drive is your >> bottleneck. =A0Given our little data is actually moving through the sdc >> drive, it's not very fast. >> >>> Device: =A0 =A0rrqm/s wrqm/s =A0 r/s =A0 w/s =A0rsec/s =A0wsec/s =A0 = =A0rkB/s =A0 =A0wkB/s >> >>> 8GB memory in total. 1GB devoted to PGSQL during these operations. >>> Otherwise, my settings are as follows (and yes I did make the vacuum >>> settings more aggressive based on your email, which has had no >>> apparent impact) -- >> >> Yeah, as it gets more aggressive it can use more of your IO bandwidth. >> =A0Since you >> >>> What else can I share? >> >> That's a lot of help. =A0I'm assuming you're running software or >> motherboard fake-raid on this RAID-1 set? =A0I'd suggest buying a $500 >> or so battery backed caching RAID controller first, =A0the improvements >> in performance are huge with such a card. =A0You might wanna try testing >> the current RAID-1 set with bonnie++ to get an idea of how fast it is. >> >