SELECT ... EXCEPT SELECT ... takes too long! Why?

From: Michael Andreasen <michael(at)systems(dot)to>
To: pgsql-general(at)postgresql(dot)org
Subject: SELECT ... EXCEPT SELECT ... takes too long! Why?
Date: 1999-06-30 09:52:17
Message-ID: 3779E8D1.9DC1315E@systems.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a table;

create table product ( prod varchar(10) description varchar(40));

This is the master table. I also have serval other tables the same
(varchar(10), varchar(40)) and want to merge the rows from these tables
into the master one, only where rows don't already exist in the master
table.

I am doing this as follows;

insert into product
select prod, description from product_copy1 except
select prod, description from product;

This does work, but it takes FOREVER to perform. I have about 10,000
rows in each table and it is taking 20 mins. On the same System I can do
4,000,000 row inserts in 6 minutes, so this to slow.

Any help?

Browse pgsql-general by date

  From Date Subject
Next Message Bryan White 1999-06-30 13:29:08 Default values not working
Previous Message inlin 1999-06-30 06:21:26 About the restore from V1.09 to V6.3.2