I was wondering what the best way is to implement a tag system, like the one used on SO. I was thinking of this but I can\'t come up with a good scalable solution.
I
CREATE TABLE Tags (
tag VARHAR(...) NOT NULL,
bid INT ... NOT NULL,
PRIMARY KEY(tag, bid),
INDEX(bid, tag)
)
Notes:
AUTO_INCREMENT
PK. Hence, it is better than Scuttle.LIKE
with leading wild card; false hits on substrings)Related discussions (for MySQL):
many:many mapping table optimization
ordered lists