开发者

md5 hash for urls in unique Index

I was asked this before with slight different with current question开发者_开发技巧. but did not got the answer I was looking into.

My question is do I need to store md5($url) in unique index in MySQL?? I have seen this in some code actually I don't remember..this is a large database with more than 5 million urls and the indexing is done by calling urls.

Any ideas?


I don't think you should hash your URLs. The only plausible reason would be to save space (if most of the URLs are larger than 32 chars) at the expense of increased risk of collisions.

What you should do is normalize the URLs.


Some sites uses hashing for urls in the database because they use hashes in urls say for user redirect to external url. I can't see any reason to do this if this is not the case.


are you saying that the url is called as such:

www.yourdomain.com?id=89ce9250e9f469c9d1816e1cc0fb47a1

and then the id (89ce9250e9f469c9d1816e1cc0fb47a1 which is an md5() of the real url querystring) is looked up from the database to resolve the actual url which could be:

www.yourdomain.com?user=23&location=5&eventtype=23&year=2010

Is this the kind of usage you're referring to??

jim

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜