I’ve been having this problem with OpenPhoto which resulted in having over 90,000 records in my tags table.

To fix this problem, simply run this sql:

ALTER IGNORE TABLE  `database name`.`prefix_tag` ADD UNIQUE  `unique` (  `id` )