
May 27th, 2007, 11:09 AM
|
|
Registered User
|
|
Join Date: May 2007
Posts: 1
Time spent in forums: 49 m 53 sec
Reputation Power: 0
|
|
|
Insert with no existance check
Question...
I have an application in which there just exist certain rows in a table.
Each time the program opens I have it insert the rows.
I do not check that the rows already exist before adding the new rows.
My theory is that checking first would require 1 round trip to the database to see if the records exist, and then another trip to and from the database to insert the record if it did not already exist. For a minimum of 1 round trip if the data already exists and two round trips if it does not already exist.
Instead, by just issuing the insert statement, I will always end up with a maximum of 1 trip to the database.
Anybody have a reason that I should check first instead of just inserting?
|