Best practice for managing user balances for multiple tokens in SQL
I have 2 tables in this moment, User (userId, name, …) and Token (tokenId, name, …). Each user can buy and sell an x amount of every token. Tokens can be added over time. I thought it’s a good idea to have a table “Balance” (id, userId, tokenId, tokenAmount). The thing is I don’t know if is a good practice, because of the logic I have to apply (when a user buy a token, I have to find and update the balance, or create a new row in the table). We expect to have thousands of users in our system.