Re: Importing a Large .ndjson file

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Sankar P <sankar(dot)curiosity(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Importing a Large .ndjson file
Date: 2020-06-18 18:09:11
Message-ID: CAHOFxGotx8i1U+B6bFyw_zviqN0sFk6xKFA_MHtwr-3G8ScyRg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> 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.
>

It is always recommended to create indexes AFTER loading data. Sometimes it
can be faster to drop all indexes on the table, load huge data, and
re-create the indexes but there's no hard & fast rule. If you are adding
100k records to an empty or near empty table, I would remove all indexes
and create them after. Be sure you have sufficient maintenance_work_mem
also.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2020-06-18 18:30:25 Re: Importing a Large .ndjson file
Previous Message Sankar P 2020-06-18 17:38:44 Re: Importing a Large .ndjson file