I have a large table containing 500,000 records or more with a primary key.
When attempting to INSERT records into the table, I need to ensure that I
don't violate the Primary Key constraint. To do this I use a subquery in
the WHERE clause, but I find that the INSERT statement with large record
sets sometimes takes several hours to complete because the subquery is generated
for every record being inserted into the table. Is there a quick way to
insert unique records into a table that has a primary key? An example of
the SQL statement I am currently using is shown below.

INSERT INTO TARGET (PHONENUM, NAME)
SELECT CUSTPHONE, CUSTNAME FROM SOURCE WHERE CUSTPHONE NOT IN (SELECT PHONENUM
FROM TARGET)

Thanks,
Suresh