Re: Optimize for insertions?

From: Francisco Reyes <lists(at)natserv(dot)com>
To: Gurupartap Davis <partap(at)yahoo(dot)com>
Cc: PostgreSQL-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Optimize for insertions?
Date: 2001-11-27 15:38:07
Message-ID: 20011127103232.S95906-100000@zoraida.natserv.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 26 Nov 2001, Gurupartap Davis wrote:

> I'm worried about creating indexes after all the data is in there,
> though...I'm going to need 4-5 indexes. Isn't that going to take a hella
> long time? How are indexes created anyhow? I would assume a linear search
> through every record in the table...would vacuum help at all? how bout
> vacuum analyze?

I am somewhat of a newbie, but I was told that 'copy' doesn't use the
indexes so you could create your indexes and when you are all done with
the copy commands then run a vacuum analyze.

I do bulk uploads daily from a Foxpro system, been 7million my biggest
table, and I have found that a plain vacuum is helpfull after each bulk upload.
When I am done with all my bulk uploads, 3 files, then I do one vacuum analyze.

In theory you could just do a single vacuum analyze when you are all done,
but for me a vacuum after each upload seems to help. In particular I am
still trying to decide whether to use truncate or delete's. When I use
delete old the old records seems to still "be around" so the vacuum gets
rid of them. The main advantage of truncate is that it is a fast way to
empty a table, it's main drawback is that it can not be rolled back.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Reyes 2001-11-27 15:44:58 Re: Timing a query
Previous Message William WAISSE 2001-11-27 15:37:39 Re: newbie needs help with postgres internal tables