1

I want to store url's as unique in a mysql database table but with string type varchar and text the length of a 1000 is too long. Lengths of Search engine friendly url's can be typically long,whats an acceptable length?

Baadier Sydow
  • 506
  • 1
  • 6
  • 19
  • 1
    Possibly of use: http://www.supermind.org/blog/740/average-length-of-a-url-part-2 – Wrikken Sep 20 '10 at 23:45
  • 1
    If you are using VARCHAR, I'm not sure why you think 1000 is too long. VARCHAR only uses the space it needs for a given entry. – Andrew Sep 20 '10 at 23:46
  • when i declare the varchar as UNIQUE it needs a length to go with it so i would prefer to call it with no length so it can use the maximum of 65000(i think) if possible just to be covered – Baadier Sydow Sep 20 '10 at 23:56

1 Answers1

1

There really is no length that will guarantee unique- if you want to make sure a string of a given length is unique, you need to take a hash of the string and compare it, MD5 and SHA1 are common algoritms people use.

automagic
  • 1,067
  • 8
  • 10