Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baVlp-00041F-El for pgsql-performance@arkaria.postgresql.org; Thu, 18 Aug 2016 22:26:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1baVlp-0001xO-11 for pgsql-performance@arkaria.postgresql.org; Thu, 18 Aug 2016 22:26:41 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1baVlo-0001xC-Bf for pgsql-performance@postgresql.org; Thu, 18 Aug 2016 22:26:40 +0000 Received: from mbob.nabble.com ([162.253.133.15]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baVll-0004xL-5W for pgsql-performance@postgresql.org; Thu, 18 Aug 2016 22:26:39 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mbob.nabble.com (Postfix) with ESMTP id 8F3382F13606 for ; Thu, 18 Aug 2016 15:26:20 -0700 (PDT) Date: Thu, 18 Aug 2016 15:26:35 -0700 (MST) From: pinker To: pgsql-performance@postgresql.org Message-ID: <1471559195448-5917136.post@n5.nabble.com> In-Reply-To: <0805fb3c-ed48-bece-690c-5e60c7b40e65@BlueTreble.com> References: <1471434303741-5916781.post@n5.nabble.com> <0805fb3c-ed48-bece-690c-5e60c7b40e65@BlueTreble.com> Subject: Re: Big data INSERT optimization - ExclusiveLock on extension of the table MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) 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 > 1. rename table t01 to t02 OK... > 2. insert into t02 1M rows in chunks for about 100k Why not just insert into t01?? Because of cpu utilization, it speeds up when load is divided > 3. from t01 (previously loaded table) insert data through stored procedure But you renamed t01 so it no longer exists??? > to b01 - this happens parallel in over a dozen sessions b01? that's another table - permanent one > 4. truncate t01 Huh?? The data were inserted to permanent storage so the temporary table can be truncated and reused. Ok, maybe the process is not so important; let's say the table is loaded, then data are fetched and reloaded to other table through stored procedure (with it's logic), then the table is truncated and process goes again. The most important part is holding ExclusiveLocks ~ 1-5s. -- View this message in context: http://postgresql.nabble.com/Big-data-INSERT-optimization-ExclusiveLock-on-extension-of-the-table-tp5916781p5917136.html Sent from the PostgreSQL - performance mailing list archive at Nabble.com. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance