Skip site navigation (1) Skip section navigation (2)

Bulk Insert and Index use

From: Rudi Starcevic <tech(at)wildcash(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Bulk Insert and Index use
Date: 2004-08-10 23:04:02
Message-ID: 41195462.9090303@wildcash.com (view raw or flat)
Thread:
Lists: pgsql-performance
Hi,

I have a question on bulk checking, inserting into a table and
how best to use an index for performance.

The data I have to work with is a monthly CD Rom csv data dump of
300,000 property owners from one area/shire.

So every CD has 300,000 odd lines, each line of data which fills the 
'property' table.

Beginning with the first CD each line should require one SELECT and
one INSERT as it will be the first property with this address.

The SELECT uses fields like 'street' and 'suburb', to check for an 
existing property,
so I have built an index on those fields.

My question is does each INSERT rebuild the index on the 'street' and 
'suburb' fields?
I believe it does but I'm asking to be sure.

If this is the case I guess performance will suffer when I have, say, 
200,000
rows in the table.

Would it be like:

a) Use index to search on 'street' and 'suburb'
b) No result? Insert new record
c) Rebuild index on 'street' and 'suburb'

for each row?
Would this mean that after 200,000 rows each INSERT will require
the index of 000's of rows to be re-indexed?

So far I believe my only options are to use either and index
or sequential scan and see which is faster.

A minute for your thoughts and/or suggestions would be great.

Thanks.
Regards,
Rudi.


Responses

pgsql-performance by date

Next:From: Rod TaylorDate: 2004-08-10 23:06:52
Subject: Re: Hardware upgrade for a high-traffic database
Previous:From: Litao WuDate: 2004-08-10 21:44:00
Subject: Re: Slow select, insert, update

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group