php - What's the best way to display the number of items related to tags? -


After making recommendation about tag table structure, I have implemented the following design:

 < Code> Table: item column: item id, title, content table: tag column: tag id, title table: item tag column: item id, tag id  

I'm facing another problem Is, I want to display each number that appears in the tag system, search query / php code context What is the best way to do this that does not severely impact performance (tag went calculation will appear for each item).

Thank you,

Select the Count (*) from the Roy Item Tag where the tag id = x

 

is mySQL which will get it dynamically I

If you are about performance hits If you are worried, then you should store a count in the tag table, and when you tag or untag an item, then you should increase / decrease.


Comments