I was once told that it’s faster to just start the insert and paste the failure than to check if the database record exists and then insert if it is missing.
I was also told that most databases are highly optimized for reading, not writing, so a quick check was faster than a slow insert?
Is this a matter of the expected number of collisions? (IE is faster to embed only if there is a slight chance that the record already exists.) Does it depend on the type of database I'm running? And in this regard, does bad practice have a method that will constantly add insert errors to my error log?
Thanks.
source share