I am building an app which requires users to fill out a questionnaire on a daily basis. The questions are always the same. Essentially it is a diary system and ‘entries’ are made on a daily basis (each entry is the set of answers to the 5 questions on a particular date by a particular user).
My question is this:
What is the best way to orgabise this in terms of database schematics? I was thinking of having two tables:
Users:
username(pk)
password
.
.
diaryNo
Entries:
date(pk)
diaryNo(pk)
Qu1
Qu2
...
My problem with this is that the entry table will store entries for all users. A particulat entry can be mapped to a user by linking diaryNo. Obviously after a while, the entries table will become massive and sql performance will decrease.
This must be a common problem- are there any workarounds? better ideas for implementation?
An index on either
Entries (diaryNo)orEntries (diaryNo,date), especially if you are selectingEntriesbased ondiaryNofrequently. i.e.diaryNo=?appears in most of the select queries.