Re: Importing a Large .ndjson file

2020-06-18 Thread Sankar P
> 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 cheape

Re: Importing a Large .ndjson file

2020-06-18 Thread Tom Lane
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 updati

Re: Importing a Large .ndjson file

2020-06-18 Thread Michael Lewis
> > 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 index

Re: Importing a Large .ndjson file

2020-06-18 Thread Sankar P
> > It looks like plain old COPY would do this just fine, along the lines > > of (in psql) > > > > \copy myTable(content) from 'myfile.ndjson' 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

Re: Importing a Large .ndjson file

2020-06-18 Thread Sankar P
> It looks like plain old COPY would do this just fine, along the lines > of (in psql) > > \copy myTable(content) from 'myfile.ndjson' > Indeed. Thanks. -- Sankar P http://psankar.blogspot.com

Re: Importing a Large .ndjson file

2020-06-17 Thread Tom Lane
Sankar P writes: > I have a .ndjson file. It is a new-line-delimited JSON file. It is > about 10GB and has about 100,000 records. > Some sample records: > { "key11": "value11", "key12": [ "value12.1", "value12.2"], "key13": { > "k111": "v111" } } \n\r > { "key21": "value21", "key22": [ "value22.1"

Importing a Large .ndjson file

2020-06-17 Thread Sankar P
Hi I have a .ndjson file. It is a new-line-delimited JSON file. It is about 10GB and has about 100,000 records. Some sample records: ``` { "key11": "value11", "key12": [ "value12.1", "value12.2"], "key13": { "k111": "v111" } } \n\r { "key21": "value21", "key22": [ "value22.1", "value22.2"] } ```