Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 5F53D13364DE for ; Mon, 18 Apr 2011 02:14:44 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 03594-05 for ; Mon, 18 Apr 2011 05:14:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f174.google.com (mail-iw0-f174.google.com [209.85.214.174]) by mail.postgresql.org (Postfix) with ESMTP id F05B31337B54 for ; Mon, 18 Apr 2011 02:14:35 -0300 (ADT) Received: by iwn34 with SMTP id 34so3609068iwn.19 for ; Sun, 17 Apr 2011 22:14:35 -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=KOKsr3BnJaVaCeApe6IKWuU+oZ1+5sw3SdXhlqazv/w=; b=Bf2cr1Dd6IL65eDABRRluiAkSEbBZVCRHCqgyTGe9HE32MYGh6F7acgQIYGK2+KNTW RxVyAMgGM94U6ZGSHhGe2dD2OTNeaEl+l9xdGzO8q6dJDV7vLv2XVVm0i0+HntpcphsH T16ex4nDvhLonAIklJTJ7fivLa+hNQ8z6JfgE= 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=jKrznYTI1MRTdiqlyJC0C4dCajD/b4rzzwuJ9DLvKJ3MntcgvY9xq10S/xoj1AcU0Y EOwRbELV4y9Fwr1m4ecqR3LP4cvvjWccfnlpL/o21/2UAdS7ZWM1RwXT5GDW+OTueuB5 nSFKOHk3TLLvcwOJMJssBTCI1b4bYgw0E7VRg= MIME-Version: 1.0 Received: by 10.42.97.65 with SMTP id m1mr5379874icn.379.1303103674818; Sun, 17 Apr 2011 22:14:34 -0700 (PDT) Received: by 10.42.226.68 with HTTP; Sun, 17 Apr 2011 22:14:34 -0700 (PDT) In-Reply-To: References: Date: Mon, 18 Apr 2011 13:14:34 +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.898 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201104/235 X-Sequence-Number: 43297 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 This probably means the server terminated abnormally before 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 wr= ote: > On Sun, Apr 17, 2011 at 10:59 AM, Phoenix wrote= : >> 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 =A0= rkB/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 =A0= 0.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 =A0= rkB/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. >