• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Efficient DB calls to update recycler view

keshk

Lurker
I have a mysql database holding my data. It consists of various texts and a couple of image urls for each row. I am loading each of these rows onto a recycler view.

I am confused on how to do this efficiently. Assuming I have a million rows, it would be insane to fetch them all at once. Its not like user can see all the data in one go.

But if I say fetch 10 rows at a time, keep count of last row and fetch the next 10 rows via another dB call after some scrolling, I find that insane too. So many dB calls which gets worse with multi users.

This dB is getting updated meanwhile.. Meaning I actually can't use the method of keeping count on the last row cos that means I am missing out on the latest inserts into the dB.

What's the usual solution here. It seems like a common situation like how twitter handles its scrolling updates but I am struggling to find references online.

I am trying to solve this without nosql. Appreciate any advice. Thanks.
 
Back
Top Bottom