I have created a view like gmail inbox where inbox is clickable from left side and then there are tabs on top , like Promotions, Forums etc. When user will click on each tab, then the set of items that belong to that tab is shown, for example - forums and MySQL query is fired.
The individual views can have little differences in items look and feel but navigation is alike.
So, there are individual SQL queries being fired for each tab on click, but now I have to also show count of total items for each tab all the time and keep it updated upon click of any other tab / left main icon as well.
So, I am ending up firing SQL queries for all tabs and keep their counts all the time which is very database intensive.
The other extreme will be to keep all such counts in MySQL table and increment/decrement it all the time for which I need to change all existing functionality. Please suggest other means for such navigations.
PHP Yii framework 1.1.* and MySQL 5.6.