I'm have a lot of queries where i have to check if a record exists
and if it does, increment a counter in it (most of the time). If it doesn't
exist I insert a new record with counter=1 (this case is rare).

Right now I do a select form Perl and then do one or the other.
To speed things up I could always do an INSERT IGNORE and always an UPDATE.
This would save one statement on the INSERT case, but that is rare anyway.

I'd really like to do this in one (fast) statement, since this is a
real time application with literally milions of UPDATEs that come in
this way every day.

Would it be possible to write a UDF to do this ? 

Cheers,
        Jan
-- 
Jan Willamowius, [EMAIL PROTECTED], http://www.willamowius.de/
Caution: Penguin Inside !

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to