Normilization Best Practices
Does anyone have a guide to best practices for normilization of the tables in Convex, maybe assumptions you would do in RDMS/SQL but wouldn't do in Convex.
5 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
I think that in general, the same rules apply. I personally prefer to start with a fully normalized data model, and only denormalize as performance requires.
Yeah that seems to be my approach also
If you have questions about specific scenarios, feel free to share those and we'll be glad to try to advise as well!
Yeah I think I have a lot of cases where in my SQL db I have a table that only holds like many to many, that are usually only a couple to the main entity.
Like
Contact
to ContactRoles
to Roles
, maybe it has a few extra fields on the ContactRoles
like start and end date but that is it
So since I last asked this, I haven't moved to Convex but I am rethinking this approach. I have slowly moved my current REST api to be more normalized which would translate 1:1 for convex at this point. But one thing I have also started doing is slowly moving to a semi local first approach by pulling all data in a collection to the client and doing joins and such on the client side. I feel like this would be much simplier on convex specially with the real time updates. I would say most of our collections for an average customer may have 5-10k rows in it. My concern is how does this impact costs, I think we would have a high cache hit rate with this approach