On 15/06/2005 10:28 a.m., Kevin Burton wrote:
I've been thinking about this for a while now.

If you have an app that can compute a unique key (hashcode) and you have a unique index it should be possible to just do an INSERT instead of a SELECT first to see if the record doesn't exist and then an INSERT.

This should be 2x faster than the SELECT/INSERT combo right?


I'm not entirely clear what you're talking about, but you could also have a look at INSERT IGNORE..., or INSERT... ON DUPLICATE KEY UPDATE, or REPLACE INTO...:

http://dev.mysql.com/doc/mysql/en/insert.html
http://dev.mysql.com/doc/mysql/en/replace.html

-Simon

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to