Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUjKL-0007Vt-Of for pgsql-performance@arkaria.postgresql.org; Wed, 26 Aug 2015 22:37:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZUjKL-0002q1-8w for pgsql-performance@arkaria.postgresql.org; Wed, 26 Aug 2015 22:37:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZUjIh-0000yg-Uz for pgsql-performance@postgresql.org; Wed, 26 Aug 2015 22:36:12 +0000 Received: from mail-wi0-f171.google.com ([209.85.212.171]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZUjIe-0002xl-I4 for pgsql-performance@postgresql.org; Wed, 26 Aug 2015 22:36:11 +0000 Received: by wicja10 with SMTP id ja10so28175939wic.1 for ; Wed, 26 Aug 2015 15:36:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=QnESuXDQqkZoUvlTvcN25FUHHOyVi4m8uU26lWX14+k=; b=CCBpD5q6fZ/cp67eYOHTYydmN6aukTHCh/ufVee5hApmf++u4uTjOeaZ9TDJHSmloY N9nToXFVUjDcFJ2uTN8Oy2lQJlvaw8tg1qa0ANsgLoVN4leZA64gEVczq0+FIWCM29N5 a4coP1/FjsJbHWDSpsVvDzOdl/TS9jD1gsOZ1/KmHI580dJ1M0D5JF0RYk/kVNUA/sMO t2VtBMGe+7/PlDkDrmVxov9y7t/m5ZZyDwdI7iF7P9w//YEJFZISyYE5QI9VtCp7fcae Ay6dcyMaP23pgr2BC/t24c3M2SWJuEnlHbcJ4fSv20ErbHpMG1QtJKRX5SoAET/nv2ow GXAQ== X-Gm-Message-State: ALoCoQklfLZzH6vqk2fGb1Zxbcco1qep66JQaTeS79vRFATi1bbEgYBHATGX4j5ulru4o5XXl0HmP/SqyUZ4IuuZfcLZlsJaq0eTWfkJbuq5zfPeT8EvfGOIhGprKIrXFgfuygbJ4m/Hy5xTwWcEapL/j5BaMVytZTvf2aQxBopXf6W2ci4P2/VzVHN5H4ozOVa0A2d9lg60ouAsTCa561CaoMpnmg5XRg== X-Received: by 10.180.81.67 with SMTP id y3mr15651792wix.42.1440628566381; Wed, 26 Aug 2015 15:36:06 -0700 (PDT) Received: from [10.137.2.12] (ip-78-45-136-74.net.upcbroadband.cz. [78.45.136.74]) by smtp.gmail.com with ESMTPSA id w8sm682964wiy.10.2015.08.26.15.36.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2015 15:36:05 -0700 (PDT) Message-ID: <55DE3F53.3060606@2ndquadrant.com> Date: Thu, 27 Aug 2015 00:36:03 +0200 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Index creation running now for 14 hours References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Hi, On 08/26/2015 11:53 PM, Tory M Blue wrote: > > > On Wed, Aug 26, 2015 at 2:45 PM, Qingqing Zhou > > wrote: > > On Wed, Aug 26, 2015 at 1:26 PM, Tory M Blue > wrote: > > > > Right now the 100% cpu process which is this index is only using > 3.5GB > > and has been for the last 15 hours > > > > If 100% cpu, you can do 'sudo perf top' to see what the CPU is busy > about. > > Regards, > Qingqing > > > > I appreciate the attempted help, but I know what it's doing, it's > creating indexes for the last 14+ hours. Sure, but what exactly was it doing? 'perf top' might give us a hint which function is consuming most of the time, for example. > I've killed it now, as it was > about to run my machine out of disk space, stopped it at 97% full, could > not go any longer. Which suggests it's using a lot of temp files. Indexes are built by reading all the necessary data from the table (just the columns), sorted and then an index is built using the sorted data (because it can be done very efficiently - much faster than when simply inserting the tuples into the btree index). The fact that you ran out of disk space probably means that you don't have enough space for the sort (it clearly does not fit into maintenance_work_mem), and there's no way around that - you need enough disk space. > I will now clean up the table a bit but will still have 500million rows > with 6 indexes on it. I will create the indexes after the data is laid > down vs during, so it doesn't block my other table replications. I will > then fire off my index creations in parallel for my other tables so I > can actually use the hardware the DB is sitting on. That's a very bad idea, because each of the index builds will require disk space for the sort, and you're even more likely to run out of disk space. > > But I guess the answer is, no real way to tell what the box is doing > when it's creating an index. Yes there was a lock, no I could not find a > way to see how it's progressing so there was no way for me to gauge when > it would be done. Had it been waiting on a lock, it wouldn't consume 100% of CPU. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance