I'm using Firebase Database to show News in my android application, my application limit firebase to the first 10 posts and gets another 10 when scrolling listview... and I want to know if the firebase database gets all posts and limit it to 10 ? or get only the first 10 posts? Because if the firebase database is fetching all the data and then taking the first 10 it will take a lot of time if there is a lot of data (posts) in my database. so I hope someone helps me to understand this process And what is best for me? fetch all data then add 10 posts to listview and when scrolling add another 10 Or do I fetch 10 posts from the firebase database for each scroll? Thanks in advance :)
CodePudding user response:
If you use limitToFirst()
or limitToLast
and have added the correct index, Firebase will only retrieve the number of nodes you indicate.