I have the following one-to-many relationship:
Account 1--* User
The Account
contains global account-level information, which is mutable.
The User
contains user-level information, which is also mutable.
When the user signs-in, they need both Account
and User
information. (I only know the UserId
at this point).
I ideally want to design the schema such that a single query is necessary. However, I cannot determine how to do this without duplicating the Account
into each User
and thus requiring some background Lambda job to propagate changes to Account
attributes across all User
objects -- which, for the record, seems like more resource usage (and code to maintain) than simply normalizing the data and having 2 queries on each sign-in: fetch user, then fetch account (using an FK inside the user object that identifies the account).
Is it possible to design a schema that allows one query to fetch both and doesn't require a non-transactional background job to propagate updates? (Transactional batch updates are out of the question, since there's >25 users.) And if not, is the 2-query idea the best / an acceptable method?