How to implement tagging system similar to SO in php/mysql?
I'm coding a website in PHP/MySQL and I'd like to implement a similar to stackoverflow tagging engine. I have 3 relevant tables in DB: 1. Items 2. Tags 3. ItemTagMap (maps tags to items, n:n mapping) Now, on search page I'd like to show distinct list of all tags for entire search result (not just the current page), so that users can "refine" their search by adding/removing tags from that tag list. The question is that it's a pretty heavy query on the DB and there can be tons of search requests that result in different result sets and thus different tag sets. Does anyone know how to implement