Re: [PERFORM] faster INSERT with possible pre-existing row?

2005-07-26 Thread John A Meinel
Dan Harris wrote: I am working on a process that will be inserting tens of million rows and need this to be as quick as possible. The catch is that for each row I could potentially insert, I need to look and see if the relationship is already there to prevent multiple entries. Currently

Re: [PERFORM] faster INSERT with possible pre-existing row?

2005-07-26 Thread Luke Lonergan
John, On 7/26/05 9:56 AM, John A Meinel [EMAIL PROTECTED] wrote: You could insert all of your data into a temporary table, and then do: INSERT INTO final_table SELECT * FROM temp_table WHERE NOT EXISTS (SELECT info FROM final_table WHERE id=id, path=path, y=y); Or you could load it into

Re: [PERFORM] faster INSERT with possible pre-existing row?

2005-07-26 Thread Sven Willenberger
On Tue, 2005-07-26 at 10:50 -0600, Dan Harris wrote: I am working on a process that will be inserting tens of million rows and need this to be as quick as possible. The catch is that for each row I could potentially insert, I need to look and see if the relationship is already there to

Re: [PERFORM] faster INSERT with possible pre-existing row?

2005-07-26 Thread Matthew Nuzum
On 7/26/05, Dan Harris [EMAIL PROTECTED] wrote: I am working on a process that will be inserting tens of million rows and need this to be as quick as possible. The catch is that for each row I could potentially insert, I need to look and see if the relationship is already there to prevent

Re: [PERFORM] faster INSERT with possible pre-existing row?

2005-07-26 Thread John A Meinel
Matthew Nuzum wrote: On 7/26/05, Dan Harris [EMAIL PROTECTED] wrote: I am working on a process that will be inserting tens of million rows and need this to be as quick as possible. The catch is that for each row I could potentially insert, I need to look and see if the relationship is already

Re: [PERFORM] faster INSERT with possible pre-existing row?

2005-07-26 Thread Mark Lewis
Easier and faster than doing the custom trigger is to simply define a unique index and let the DB enforce the constraint with an index lookup, something like: create unique index happy_index ON happy_table(col1, col2, col3); That should run faster than the custom trigger, but not as fast as the

Re: [PERFORM] faster INSERT with possible pre-existing row?

2005-07-26 Thread Christopher Kings-Lynne
Insert into a temp table then use INSERT INTO...SELECT FROM to insert all rows into the proper table that don't have a relationship. Chris Dan Harris wrote: I am working on a process that will be inserting tens of million rows and need this to be as quick as possible. The catch is that for