After following this recommendation regarding tags tables structure, I’ve implemented the following design:
Table: Item Columns: ItemID, Title, Content Table: Tag Columns: TagID, Title Table: ItemTag Columns: ItemID, TagID
I’m facing another problem, I wanna display the number each tag appears in the system. What’s the best way to do this in terms of search query / php code that will not cause a severe performance impact (tags count will appear for each item).
Thanks,
Roy
is mySQL that will get it dynamically.
If you’re worried about the performance hit, you should store a count in the tag table, and increment/decrement it when you tag or untag an item.