SunQuest
 
           Database Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesDatabase Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old May 27th, 2007, 11:09 AM
blktoptrvl blktoptrvl is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 1 blktoptrvl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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?

Reply With Quote
  #2  
Old May 27th, 2007, 02:45 PM
Humanetainit's Avatar
Humanetainit Humanetainit is offline
Beyond help
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Location: The Netherlands
Posts: 223 Humanetainit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 32 m 30 sec
Reputation Power: 2
Does your MySQL version support REPLACE INTO?
__________________
One World... Humanetainit | Program secure

Reply With Quote
  #3  
Old May 30th, 2007, 04:15 PM
trouble trouble is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 3 trouble User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 34 sec
Reputation Power: 0
Quote:
Originally Posted by Humanetainit
Does your MySQL version support REPLACE INTO?


This is the OP...

Thanks for the suggestion, but MS-SQL does not support REPLACE INTO.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesDatabase Development > Insert with no existance check


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway