Welcome Guest, Not a member yet? Register   Sign In
Does this small piece of code seem ok?
#11

(This post was last modified: 10-30-2015, 01:27 PM by ignitedcms.)

Don't forget there are also costs involved in checking. Which is why GUIDs are designed so you don't have the management of repeat number overhead to worry about.

I know it doesn't seem like much of a problem to do a select before hand, but lets say you've got hundreds of thousands of visitors and these unique ids are tied to dynamically generated form inputs which a user could have many of, hundreds if not more, and before they generate a new one the db has to do a check. It could affect performance.

Choose a suitably large number random and this would avoid this.

Expect of course, for the birthday paradox

http://betterexplained.com/articles/unde...y-paradox/


And some more interesting ideas solving the birthday paradox

http://getsolid.io/blog/birthday-paradox-coding-solid/

But yes I do understand your point.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Reply


Messages In This Thread
Does this small piece of code seem ok? - by PaulD - 10-30-2015, 09:02 AM
RE: Does this small piece of code seem ok? - by ignitedcms - 10-30-2015, 11:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB