Re: large numbers of inserts out of memory strategy - Mailing list pgsql-general

From Ted Toth
Subject Re: large numbers of inserts out of memory strategy
Date
Msg-id CAFPpqQGxt7oij-HF1S23uEQHZ=fAngsbe28TvXJQkijKMwwZhw@mail.gmail.com
Whole thread Raw
In response to Re: large numbers of inserts out of memory strategy  (Rob Sargent <robjsargent@gmail.com>)
Responses Re: large numbers of inserts out of memory strategy
Re: large numbers of inserts out of memory strategy
List pgsql-general
On Tue, Nov 28, 2017 at 11:19 AM, Rob Sargent <robjsargent@gmail.com> wrote:
>
>> On Nov 28, 2017, at 10:17 AM, Ted Toth <txtoth@gmail.com> wrote:
>>
>> I'm writing a migration utility to move data from non-rdbms data
>> source to a postgres db. Currently I'm generating SQL INSERT
>> statements involving 6 related tables for each 'thing'. With 100k or
>> more 'things' to migrate I'm generating a lot of statements and when I
>> try to import using psql postgres fails with 'out of memory' when
>> running on a Linux VM with 4G of memory. If I break into smaller
>> chunks say ~50K statements then thde import succeeds. I can change my
>> migration utility to generate multiple files each with a limited
>> number of INSERTs to get around this issue but maybe there's
>> another/better way?
>>
>> Ted
>>
> what tools / languages ate you using?

I'm using python to read binary source files and create the text files
contains the SQL. Them I'm running psql -f <file containing SQL>.


pgsql-general by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: large numbers of inserts out of memory strategy
Next
From: Ted Toth
Date:
Subject: Re: large numbers of inserts out of memory strategy