[SR-Users] too long mysql table key

Juha Heinanen jh at tutpro.com
Sat Apr 15 08:27:34 CEST 2017


Daniel-Constantin Mierla writes:

> > Looks like default charset is something (e.g. utf8), where one char takes
> > more than 1 byte and 767 limit is exceeded.
> >
> > Any suggestions on how to solve this?
> >
> I haven't trying for UNIQUE, but it may be the same as for usual INDEX
> where one can provide the length for column (prefix size to be taken in
> consideration).

Weird, but when I dropped kamailio db and created it again, the error
disappeared.  I then checked and charset is latin1, not utf8:

CREATE TABLE `domain_attrs` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `did` varchar(64) NOT NULL,
  `name` varchar(32) NOT NULL,
  `type` int(10) unsigned NOT NULL,
  `value` varchar(255) NOT NULL,
  `last_modified` datetime NOT NULL DEFAULT '2000-01-01 00:00:01',
  PRIMARY KEY (`id`),
  UNIQUE KEY `domain_attrs_idx` (`did`,`name`,`value`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

I still don't understand why value (and name) need to be part of the
index, since lookup_domain() loads attributes based on did only.

-- Juha



More information about the sr-users mailing list