Re: Fastest way to load data in a table

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Antonio Navarro Navarro <hostmaster(at)bemarnet(dot)es>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Fastest way to load data in a table
Date: 2001-09-26 10:40:47
Message-ID: 20010926204047.A26521@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Sep 26, 2001 at 11:17:10AM +0200, Antonio Navarro Navarro wrote:
> Hi all.
>
> I need to clean and fill periodically a database with several hundred thousands
> records readed from a plain ascii file.
>
> I have a Python script that opens the file and then, after a 'DELETE *
> FROM table' submits an INSERT for each registry, but this process is very slow.
>
> How can I accelerate this uploading process ?

Are you using BEGIN and COMMIT to avoid transaction overhead?
What about using COPY?
What about using TRUNCATE?

HTH,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org>
http://svana.org/kleptog/
> Magnetism, electricity and motion are like a three-for-two special offer:
> if you have two of them, the third one comes free.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Clark Naldoza y Lopez 2001-09-26 12:24:15 PHP Related Problem
Previous Message Antonio Navarro Navarro 2001-09-26 09:17:10 Fastest way to load data in a table