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:32:12 -0700
Message-ID: <b67681ae-33b9-0f75-d04f-7d29d9218b12@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:
> 
> 
> On Fri, 9 Aug 2019, 20:08 Adrian Klaver, <adrian.klaver@aklaver.com 
> <mailto:adrian.klaver@aklaver.com>> wrote:
> 
>     On 8/9/19 4:12 AM, Shital A wrote:
>      > Hello
>      >
>      > Postgresql 9.6
>      >
>      > Need to generate 1GB test data in very less time. I got some
>     techniques
>      > online but they take around 40mins for 400GB. Any quicker way?
> 
>     1) Postgres version?
> 
>     2) Data going into single table or multiple tables?
> 
>     3) What is the time frame you are trying to achieve?
> 
>     4) What techniques have you tried?
> 
>     5) If you need only 1GB why the 400GB number?
> 
> 
>      >
>      >
>      > Thanks.
>      >
> 
> 
>     -- 
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 
> 
> 
> Hello,
> 
> Sorry 400GB was a typo. Its 400 MB Details are below:
> 
> 1) Postgres version?
> 9.6
> 
> 2) Data going into single table or multiple tables?
> Single table having Multiple columns
> 
> 3) What is the time frame you are trying to achieve?
> As quick as possible.
> 
> 4) What techniques have you tried?
> Insert into with With statement, inserting 2000000 rows at a time. This 
> takes 40 mins.

Might take a look at COPY:

https://www.postgresql.org/docs/11/sql-copy.html

or its psql equivalent:

\copy.

COPY runs as the server user and sees files relative to the server location.
\copy runs as the psql(client) user.

In either case suitability will depend on where you are sourcing the 
test data from and what format it is in to begin with.


If you want a more sophisticated wrapper over the above then:

https://ossc-db.github.io/pg_bulkload/pg_bulkload.html

> 
> 5) If you need only 1GB why the 400GB number?
> That was 400MB. M checking size using \l+ option.
> 
> 
> Thanks.
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (8+ messages)  latest in thread

Message-ID: <b67681ae-33b9-0f75-d04f-7d29d9218b12@aklaver.com>
Permalink:  ../b67681ae-33b9-0f75-d04f-7d29d9218b12@aklaver.com/
Also on:    postgresql.org/message-id/b67681ae-33b9-0f75-d04f-7d29d9218b12@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: <b67681ae-33b9-0f75-d04f-7d29d9218b12@aklaver.com>
  References: <CAMp7vw-C4Yw5iutV9p7nydUBJhL0bFdfNsC+15UabHeN1SOHjg@mail.gmail.com> <f522d2fb-f70d-40cb-73a0-d8f267f65947@aklaver.com> <CAMp7vw-ajbV+RfKgBzhKJ8tEG5KFUX7dGufm-SXDDKMzo5PY5g@mail.gmail.com> <b67681ae-33b9-0f75-d04f-7d29d9218b12@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