Menu

📰
0

trouble with how to show selected user but also have few users either side.

Reddit r/SQL·u/shez19833·about 1 month ago
#I1vyaEfT
#user#users#selected#query#return#article
Reading 0:00
15s threshold

trouble with how to show selected user but also have few users either side. so creating something where you show list of users sorted (think dating app). and when you click on a user you see their profile, but then you can also move to the next/prev user in the same order as the list. so currently what i am doing is: 1. when user clicks on a user (selected) 2. run a query to only get IDs of all users (in an array) 3. find the INDEX of selected user in this array 4. create a pagination consisting of 3 records (using backend language) 5. send that to frontend. 6. when user scrolls through to the 3rd, call the endpoint again no 2 query runs initially) but on subsquent we send pack the 'current row' so it all works out perfectly. THE ISSUE is: 1. ideally i need to return the rows so if user id = 6, i return couple of users either side 2. no 2 query above will return large no of ids, so memory and speed issues tried searching but not even sure what to search for..…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More