I read that the max length of URL can be 2,000 characters. I have therefore a table with varchar(2000) column type to store URLs. But this column can not be indexing only the first 1000 characters as shown below. What is the recommended datatype for URL?
mysql> create table myweb(id int not null auto_increment, url varchar(2000), primary key (id));
Query OK, 0 rows affected (0.03 sec)
mysql> alter table myweb add key (url);
Query OK, 1 row affected, 1 warning (0.04 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> show create table myweb\G
*************************** 1. row ***************************
Table: myweb
Create Table: CREATE TABLE `myweb` (
`id` int(11) NOT NULL auto_increment,
`url` varchar(2000) default NULL,
PRIMARY KEY (`id`),
KEY `url` (`url`(1000))
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
1 row in set (0.00 sec)