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 RecyclerView.
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 and instagram handles its scrolling updates but I am struggling to find references online.
I am trying to solve this without having to switch to a nosql database. Appreciate any advice. Thanks.