This question can be somehow continuation of MySQL unique 1500 varchar field error (#1071 - Specified key was too long), but briefly:
I applied changes to mysql configuaration and increased key/unique length to 3072 bytes
ROW_FORMAT=DYNAMIC, innodb_file_format = Barracuda, innodb_large_prefix = true
If I do:
CREATE TABLE IF NOT EXISTS `pages` (
`link` varchar(1500) NOT NULL,
`domain` varchar(255) NOT NULL,
`lastvisited` datetime DEFAULT NULL,
`id` bigint(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ROW_FORMAT=DYNAMIC;
ALTER TABLE `pages` ADD UNIQUE (
`link`
)
I got error: "#1071 - Specified key was too long; max key length is 3072 bytes" what is right, as link is varchar(1500) and is 4500 bytes.
Now, with same configuration, I decided to apply next table structure:
CREATE TABLE IF NOT EXISTS `pages` (
`link` varchar(1500) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
`domain` varchar(255) NOT NULL,
`lastvisited` datetime DEFAULT NULL,
`id` bigint(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
UNIQUE KEY `link` (`link`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ROW_FORMAT=DYNAMIC;
And I get error:
#1709 - Index column size too large. The maximum column size is 767 bytes.
All changes that were made is CHARACTER SET, but this decreased column size to 767 bytes. No changes to configuration. Why?