Jump to content


Photo

When to use INSERT DELAYED


  • Please log in to reply
1 reply to this topic

#1 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 17 July 2006 - 01:06 PM

When would be appropriate to add the "DELAYED" keyword to an insert? I am writing a traffic analysis system which logs info on every pageload and click thru and info is typically inserted by connecting once, inserting the data with one query, then disconnecting. Part of the info stored is the referrer string, which can be rather long sometimes (regularly over 1000 chars for one particular referrer). How busy would the site need to be to warrant using DELAYED on the inserts?
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 17 July 2006 - 06:09 PM

There is some overhead to using DELAYED, since you're creating a second INSERT queue; however, it becomes much faster for bulk inserts because the client doesn't have to "wait" for the insert to finish before you can move on.  In other words, if your don't need to newly created ID back, then you can use delayed without a problem.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users