I was wondering if it is better to add a table column storing the number of X entries associated with the specific ID on a different table or calculate each time the number of entries with a query.
So for example I've got the following tables
Users Table
ID | name | status
------------------
1 | John | 1
2 | Jack | 2
3 | Mary | 1
Posts Table
ID | user_id | text | status
------------------------------
1 | 1 | blabla | 1
2 | 1 | blabla | 1
3 | 2 | blabla | 2
4 | 1 | blabla | 1
5 | 3 | blabla | 1
Is it better to add an extra column on the users table with the number of posts so it will be faster (? and or better?) to show a list of 100 users and number of posts without any extra queries, or else I have to check how many entries with status 1 are associated with user_id X x 100 users for example