3 ms·
What goes in the database? The whole universe? What do you leave out? What do you denormalize and index? These questions are answered by the frontend.
by lonelappde 6y ago
What goes in the database? The whole universe? What do you leave out? What do you denormalize and index? These questions are answered by the frontend.
- wolco 6y agoYou store the entire universe or whatever reporting requirement demand. You define the database structure based on the requirements of your business logic. The frontend requirements can help define what api's are required but if you treat your database as dumping tables you limit what your data can do. You add can add and remove indexes at any point. If you made a bad decision or no decision you would add those when more information is available.
- UglyToad 6y agoThere's no silver bullet I guess but I think the trap that one could fall into here is to think of "the" frontend. There's a bunch of additional consumers of the data model even for a single web-app. Auditing, security, reporting (prior to moving to a separate reporting database), internal tools, possible future mobile or desktop applications, etc. I have found the safest approach is to enforce invariants in the database rather than assume the application code will do the right thing. But as you highlight the schema can be refined by the needs of the front-end, especially where indexing is concerned.