pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Shital A <brightuser2019@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Generate test data inserts - 1GB
Date: Fri, 9 Aug 2019 08:55:00 -0700
Message-ID: <8515df43-2826-5e9b-60c8-daafe9294a9d@aklaver.com> (raw)
In-Reply-To: <CAMp7vw-ajbV+RfKgBzhKJ8tEG5KFUX7dGufm-SXDDKMzo5PY5g@mail.gmail.com>
References: <CAMp7vw-C4Yw5iutV9p7nydUBJhL0bFdfNsC+15UabHeN1SOHjg@mail.gmail.com>
	<f522d2fb-f70d-40cb-73a0-d8f267f65947@aklaver.com>
	<CAMp7vw-ajbV+RfKgBzhKJ8tEG5KFUX7dGufm-SXDDKMzo5PY5g@mail.gmail.com>

On 8/9/19 8:14 AM, Shital A wrote:
> 

> Hello,

> 
> 4) What techniques have you tried?
> Insert into with With statement, inserting 2000000 rows at a time. This 
> takes 40 mins.
> 

To add to my previous post. If you already have data in a Postgres 
database then you could do:

pg_dump -d db -t some_table -a -f test_data.sql

That will dump the data only for the table in COPY format. Then you 
could apply that to your test database(after TRUNCATE on table, assuming 
you want to start fresh):

psql -d test_db -f test_data.sql




-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (8+ messages)  latest in thread

Message-ID: <8515df43-2826-5e9b-60c8-daafe9294a9d@aklaver.com>
Permalink:  ../8515df43-2826-5e9b-60c8-daafe9294a9d@aklaver.com/
Also on:    postgresql.org/message-id/8515df43-2826-5e9b-60c8-daafe9294a9d@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, brightuser2019@gmail.com
  Subject: Re: Generate test data inserts - 1GB
  In-Reply-To: <8515df43-2826-5e9b-60c8-daafe9294a9d@aklaver.com>
  References: <CAMp7vw-C4Yw5iutV9p7nydUBJhL0bFdfNsC+15UabHeN1SOHjg@mail.gmail.com> <f522d2fb-f70d-40cb-73a0-d8f267f65947@aklaver.com> <CAMp7vw-ajbV+RfKgBzhKJ8tEG5KFUX7dGufm-SXDDKMzo5PY5g@mail.gmail.com> <8515df43-2826-5e9b-60c8-daafe9294a9d@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox