lundi 7 mars 2016

Android - store multiple values in app or relational database?

I have an app which is basically a quiz that chooses a random question from the remote MySQL database. Let's say i have a table questions with 100 records (questions).

I am implementing a functionality that allows user to prevent question from showing in the future, for example when it is too easy for him.

The problem is - should i store IDs of the questions that user disables in app's SharedPreferences or database?

Approach 1: Values are stored in SharedPreferences. Then every time I run method that gets random question from the database I add to my API URL disabled questions' ids. Major con: It can be a problem when my questions table scales up to 2000> questions and URL will be too short. I could probably use POST method in API to solve this.

Approach 2: Store the values in a special table called f.ex. questions_disabled. Then try to somehow JOIN query them. Con: Let's say I have 100 users with 50 questions disabled each. It's already 5000 records - seems a lot.

Which approach is better? Do you have any experience in situations like this? Any help highly appreciated!

Aucun commentaire:

Enregistrer un commentaire