A
A
Alexander2015-11-15 14:12:30
PHP
Alexander, 2015-11-15 14:12:30

What is the sampling principle of the user's activity feed?

Good afternoon, point me to the right thoughts please.
We have a user (user) who is subscribed to updates of 100 (10k, it doesn’t matter) other users.
It turns out that in the first request I select all the users I subscribe to,
then I select all their posts?
Something is wrong here, it looks too cumbersome, I'm sure there is a way to make the request easier.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2015-11-15
@alexis78i

Limit will help you ... take not all .. but some
but I would take it differently .. I would select all posts from all users sorted by create TimeStamp and of course limit (Well, let's say 50 posts). + Id of the very first message would be saved and subsequent requests would be made from it. the next request looks like this.
request all posts from such users sorted by creation time, posts no higher than this id (from the first request) and the limit is already 50,100.
It would also store all users (ID) to which your user is subscribed.
IMHO every time to make a selection from the database is not ice ... or caching .. which is also not ice when the number of subscriptions changes ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question