Database design for mapping users to questions
1
vote
2
answers
158
views
I'm currently building a quiz app and I need to design a database schema for it.
This is what I've tried so far:
The biggest problem I have is with how to represent which questions have been already answered correctly by each user and which haven't.
In the current design the *answered_questions* table would grow very fast (assuming a pool of 2000 questions and 1million users it would be 2 billion entries, which doesn't seem to be a scalable approach). I thought of partitioning the *answered_questions* table by *user_id* but I don't if that's the most optimal solution.
Please note that I need to keep the information about which question is already answered because for each request i will have to retrieve the following information:
* 5 questions that have been correctly answered
* 5 questions that have not been correctly answered
filtered by the *category*, *subcategory* and *user_id*.
How could I redesign it to avoid having to query the *answered_questions* table which can become very large over time?
Any help is very much appreciated.

Asked by Natural Unintelligence
(11 rep)
Oct 29, 2023, 01:38 PM
Last activity: Jul 18, 2025, 04:00 PM
Last activity: Jul 18, 2025, 04:00 PM