For example, when obtaining the number of posts per user,
In my opinion, the things that can be a determinant are
Is it different depending on the situation? How do you usually design it in practice?
database
In practice, the post table is counted.
Count is not a function that requires a lot of resources, but if there is a lot of row enough to affect the search speed, it can be solved with hints or indexes.
If the number of posts is frequently viewed, you can use the cache.
© 2024 OneMinuteCode. All rights reserved.