Re: multiple inserts - Mailing list pgsql-novice

From Bruno Wolff III
Subject Re: multiple inserts
Date
Msg-id 20050617195524.GC9670@wolff.to
Whole thread Raw
In response to Re: multiple inserts  ("Oren Mazor" <oren.mazor@gmail.com>)
List pgsql-novice
On Fri, Jun 17, 2005 at 10:31:12 -0400,
  Oren Mazor <oren.mazor@gmail.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.

pgsql-novice by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Trigger and Trigger function, Part 3 - success!
Next
From: "Vishal Kashyap @ [SaiHertz]"
Date:
Subject: