I am not sure which is the best way to proceed. I have parent child relationship where I have to determine if every vendor completed a task (this is a fictitious example).
I have a task record and typically 13 or fewer vendors who each have to complete that task. My application needs to know when all the vendors have completed the their task.
I see two options:
- Every time I need to know if all the vendors completed the task I could loop thru the vendors assigned to that task
- I could add a flag to the Task table that lets me know if all the vendors completed the task. If the flag is True I wouldn't have to loop thru all the vendors anymore.
Option 1 has performance issues. Option 2 feels wrong, but it does save database queries.
Which option is the better option? Is there an option that I haven't thought about?
Thanks