Re: faster inserting from dump?

From: "Gregory Wood" <gregw(at)com-stock(dot)com>
To: <cmarkiew(at)commnav(dot)com>
Cc: "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: faster inserting from dump?
Date: 2001-04-05 13:55:24
Message-ID: 000501c0bdd8$10b1fea0$7889ffcc@comstock.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> how can i increase the speed of building a database from a dump? there
are
> currently many tens-of-thousands of insert statements...i assume that a
> commit is run after each statement?

Correct... every statement is wrapped in an implicit transaction if an
explicit one is not provided.

> i am guessing that it would be faster
> if i commit after every hundred or thousand?

Correct again.

> is there an easy way to tell psql to do this?

Just use BEGIN; and COMMIT; to denote a transaction block. That's it!

You might also want to research the COPY command for doing bulks imports. I
personally use INSERTs because I need to have my importing error checked,
but if you can guarantee the integrity of the import, COPY is your best bet.

Greg

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nick T 2001-04-05 13:56:58 memory leaks fixed?
Previous Message chris markiewicz 2001-04-05 13:46:57 faster inserting from dump?