in reply to Re: perl (mysql) question...
in thread perl (mysql) question...

I think it is easier on the MySQL database to use the COUNT * ...-idiom to test whether a record exists, rather than relying on a failing insert because the primary key already exists.

The docs of MySQL state that COUNT * ... has been specifically optimised for such things.

Update:On second thought, if you have to insert the new data anyhow, then perhaps it is more resource-effective to rely on the "primary key already existing"-error, provided that most of the inserts are likely to succeed and such errors are rare.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law