pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Teemu Torma <teemu@torma.org>
To: pgsql-performance@postgresql.org
Subject: Re: How import big amounts of data?
Date: Thu, 29 Dec 2005 15:41:05 +0100
Message-ID: <200512291541.05739.teemu@torma.org> (raw)
In-Reply-To: <43B3B0EA.6070406@andromeiberica.com>
References: <43B3B0EA.6070406@andromeiberica.com>

On Thursday 29 December 2005 10:48, Arnau wrote:
>    Which is the best way to import data to tables? I have to import
> 90000 rows into a column and doing it as inserts takes ages. Would be
> faster with copy? is there any other alternative to insert/copy?

I am doing twice as big imports daily, and found the follwing method 
most efficient (other than using copy):

- Use plpgsql function to do the actual insert (or update/insert if 
needed). 

- Inside a transaction, execute SELECT statements with maximum possible 
number of insert function calls in one go.  This minimizes the number 
of round trips between the client and the server.

Teemu



view thread (7+ messages)  latest in thread

Message-ID: <200512291541.05739.teemu@torma.org>
Permalink:  ../200512291541.05739.teemu@torma.org/
Also on:    postgresql.org/message-id/200512291541.05739.teemu@torma.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: teemu@torma.org
  Subject: Re: How import big amounts of data?
  In-Reply-To: <200512291541.05739.teemu@torma.org>

* 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