Optimized way to retrieve most-liked posts by category and time period
-
Hello,
I would like to implement a feature on my website using WP ULike.
I want to be able to retrieve the most-liked posts, grouped by category, and identify the most-liked posts on the site based on the number of likes within different time periods, such as:
- Weekly
- Monthly
- Quarterly (3 months)
For example, I would like to retrieve the top 10 most-liked posts in each category during the last 7 days, last 30 days, or last 3 months.
My main concern is database performance. Since my website has a large amount of content and likes, I want to implement this in the most optimized way possible with the lowest possible database load.
What approach would you recommend for this?
Specifically, would you recommend querying the WP ULike tables directly, using an existing WP ULike feature/API, creating a custom database query, or maintaining some kind of pre-calculated/aggregated data?
I would also appreciate your recommendation for the most efficient database structure or indexing strategy for this use case, especially if the rankings need to be generated regularly.
What would be the best and most optimized solution to achieve this while minimizing database queries and server load?
Thank you.
You must be logged in to reply to this topic.