mysql> explain event; +-------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+----------------+ | xid | int(11) | | PRI | NULL | auto_increment | | type | varchar(32) | YES | MUL | NULL | | | subsystem | tinytext | YES | | NULL | | | source_ipa | tinytext | YES | | NULL | | | source_host | text | YES | | NULL | | | source_user | tinytext | YES | | NULL | | | target_host | tinytext | YES | | NULL | | | target_ipa | tinytext | YES | | NULL | | | target_user | tinytext | YES | | NULL | | +-------------+-------------+------+-----+---------+----------------+ mysql> alter table event add unique(type,subsystem(16),source_ipa(32),source_host(32),source_user(16),target_host(32),target_ipa(32),target_user(16));