Re: multiple inserts

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Oren Mazor <oren(dot)mazor(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-novice(at)postgresql(dot)org
Subject: Re: multiple inserts
Date: 2005-06-17 19:55:24
Message-ID: 20050617195524.GC9670@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, Jun 17, 2005 at 10:31:12 -0400,
Oren Mazor <oren(dot)mazor(at)gmail(dot)com> wrote:
> hm. well. I'm looking at a data set that can potentially get a few
> thousand big. So I'll stick with the COPY command.
>
> the trick is that I'm inserting a 1000 row 20 column table. This gets
> super slow, as you can imagine, so I'm looking at creating a two tables, a
> 1000 row table with a single column (my unique identifiers) and a 20
> column table with a single row (the default values) and then UNIONing them.
>
> would doing a COPY be a better idea?

If you do the inserts in one transaction this should be reasonably fast.
If a program is doing the inserts more speed can be gained by using prepare.
However, copy is a better way to go if you aren't transforming or checking
the data as it is being inserted.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Vishal Kashyap @ [SaiHertz] 2005-06-18 08:40:17
Previous Message Michael Fuhr 2005-06-17 19:34:06 Re: Trigger and Trigger function, Part 3 - success!