I need save urls into a mysql table I also need to search rows by their url. In order to increase performance, I want to add UNIQUE index for url column.
CREATE TABLE `fp_feeds_in_records` (
`id` bigint auto_increment NOT NULL,
`url` varchar(1000) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
unique unique_url (val)
) ENGINE=InnoDB
But when I run CREATE statement I get error message: Error Code: 1071. Specified key was too long; max key length is 767 bytes
.
urls I need save are too long so I can't use varchar(255) as other answers suggests. MySQL version is 5.6.35.
How can I solve it?