Tag Cloud using 2 queries (one nested), and a foreach loop: Is there a better way?
Note: Your table and especially column names are quite verbose. I would remove the table name from each column as a first start and be more consistent with the names. I'll use better names below. You'll have to map it out yourself.


You can get the used tags with their counts in a single query with this statement:

select
    tag_id, 
    tag_name, 
    count(publication_id)
from
    tag join publication_tag using (tag_id) 
group by
    tag_id