Re: COPY vs INSERT - Mailing list pgsql-performance

From Tom Lane
Subject Re: COPY vs INSERT
Date
Msg-id 13782.1115387515@sss.pgh.pa.us
Whole thread Raw
In response to Re: COPY vs INSERT  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-performance
Bruno Wolff III <bruno@wolff.to> writes:
>   "Jim C. Nasby" <decibel@decibel.org> wrote:
>> Has thought been given to supporting inserting multiple rows in a single
>> insert?

> It's on the TODO list. I don't remember anyone bringing this up for about
> a year now, so I doubt anyone is actively working on it.

It is on TODO but I think it is only there for standards compliance.
It won't produce near as much of a speedup as using COPY does ---
in particular, trying to put thousands of rows through at once with
such a command would probably be a horrible idea.  You'd still have
to pay the price of lexing/parsing, and there would also be considerable
flailing about with deducing the data type of the VALUES() construct.
(Per spec that can be used in SELECT FROM, not only in INSERT, and so
it's not clear to what extent we can use knowledge of the insert target
columns to avoid running the generic union-type-resolution algorithm for
each column of the VALUES() :-(.)  Add on the price of shoving an
enormous expression tree through the planner and executor, and it starts
to sound pretty grim.

            regards, tom lane

pgsql-performance by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: COPY vs INSERT
Next
From: Tom Lane
Date:
Subject: Re: Bad choice of query plan from PG 7.3.6 to PG 7.3.9