Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlzJ0-0001Rd-Pf for pgsql-general@arkaria.postgresql.org; Thu, 18 Jun 2020 18:30:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlzIz-0006OG-Mt for pgsql-general@arkaria.postgresql.org; Thu, 18 Jun 2020 18:30:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlzIz-0006O5-Ey for pgsql-general@lists.postgresql.org; Thu, 18 Jun 2020 18:30:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlzIw-0001xF-QV for pgsql-general@lists.postgresql.org; Thu, 18 Jun 2020 18:30:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 05IIUPiL1557195; Thu, 18 Jun 2020 14:30:25 -0400 From: Tom Lane To: Sankar P cc: pgsql-general@lists.postgresql.org Subject: Re: Importing a Large .ndjson file In-reply-to: References: <1446220.1592407101@sss.pgh.pa.us> Comments: In-reply-to Sankar P message dated "Thu, 18 Jun 2020 23:08:44 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1557193.1592505025.1@sss.pgh.pa.us> Date: Thu, 18 Jun 2020 14:30:25 -0400 Message-ID: <1557194.1592505025@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Sankar P writes: > I spoke too soon. While this worked fine when there were no indexes > and finished within 10 minutes, with GIN index on the jsonb column, it > is taking hours and still not completing. There's the generic advice that building an index after-the-fact is often cheaper than updating it incrementally. For GIN indexes specifically, see also https://www.postgresql.org/docs/current/gin-tips.html regards, tom lane