Re: Importing a Large .ndjson file

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Importing a Large .ndjson file
Дата
Msg-id 1446220.1592407101@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Importing a Large .ndjson file  (Sankar P <sankar.curiosity@gmail.com>)
Ответы Re: Importing a Large .ndjson file
Список pgsql-general
Sankar P <sankar.curiosity@gmail.com> 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", "value22.2"] }

> What is the best way to do this on a postgresql database, deployed in
> kubernetes, with a 1 GB RAM allocated ?

It looks like plain old COPY would do this just fine, along the lines
of (in psql)

\copy myTable(content) from 'myfile.ndjson'

If the newlines actually are \n\r rather than the more usual \r\n,
you might have to clean that up to stop COPY from thinking they
represent two line endings not one.

I'd advise extracting the first hundred or so lines of the file and doing
a test import into a temporary table, just to verify the process.

            regards, tom lane



В списке pgsql-general по дате отправления:

Предыдущее
От: "Jim Hurne"
Дата:
Сообщение: Re: Sv: autovacuum failing on pg_largeobject and disk usage of thepg_largeobject growing unchecked
Следующее
От: Joshua Drake
Дата:
Сообщение: Re: Minor Upgrade Question