Which is more efficient?

php/mysql site… i have admins post news messages. When they log in, i want to show the number of news posts they have posted in total

what is the most efficient way of doing this?
either 1. do a select in the news table by admin and count rows and print this
or
2. every time the admin posts a message increment a counter and store it somewhere in the admin table…

the first one would probably be the easiest. However I put a counter in almost every table that I make anyway, just because you never really know when you’ll need it…

it isn’t a counter in the news table… just a column in the admin table that increments by 1 every time a news post is submitted by that admin

so like

admintable
±-------------------------------------------------------------------

adminname adminpassword adminNumberOfPosts

smart idea or no?

its my feeling its more efficient to just be
select adinNumberOfPosts from admintable where admin = admin
rather than
select * from news where admin = admin
count_rows(query)

especially if there is A LOT of news posts

ohh, I see what you mean. i was a little confuzzled before. yea that would be much more efficient. :slight_smile:

yeah :frowning: there’s a lot of things i dont know what to let handle… php or sql