Re: how to create unique key for long varchar?

2013-11-05 Thread Dan Nelson
In the last episode (Nov 05), Li Li said: I want to create a table with a long varchar column, maybe it's the url. according to dns spec, the url's max length is fixed. but I have to deal with url having long params such as

RE: how to create unique key for long varchar?

2013-11-05 Thread Rick James
. -Original Message- From: Dan Nelson [mailto:dnel...@allantgroup.com] Sent: Tuesday, November 05, 2013 7:56 AM To: Li Li Cc: mysql@lists.mysql.com Subject: Re: how to create unique key for long varchar? In the last episode (Nov 05), Li Li said: I want to create a table with a long

Re: how to create unique key for long varchar?

2013-11-05 Thread Li Li
I prefer your solution in that it's something like Optimistic Locking. but the problem is that if I define md5 as unique key and there exists 2 different urls with the same md5. I can't insert the second url anymore On Tue, Nov 5, 2013 at 11:55 PM, Dan Nelson dnel...@allantgroup.com wrote: In

Re: how to create unique key for long varchar?

2013-11-05 Thread Michael Dykman
The odds against the eventuality you are worried about are astronomically high. Much serious work on the internet would fall apart were that not true. Collision is simply not going to happen within the next several hundred thousand years. On Nov 5, 2013 9:59 PM, Li Li fancye...@gmail.com wrote:

Re: how to create unique key for long varchar?

2013-11-05 Thread Li Li
I came up with a solution: using special md5 to deal with conflicts steps to insert a url 1. insert into table(md5,url) values('md5 of url', url) 2. if get a duplicate entry for primary key 2.1 select md5,url from table where md5 like '%' for update 2.2 if url really exists, don't need

how to create unique key for long varchar?

2013-11-04 Thread Li Li
hi all I want to create a table with a long varchar column, maybe it's the url. according to dns spec, the url's max length is fixed. but I have to deal with url having long params such as a.html?q=fl= I want the url is unique