I have a system with "main" DB which stores information of vehicles in single table with…
- User
I have a system with "main" DB which stores information of vehicles in single table with vehicle_id AS PK and ist_iid AS FK indicating it owner. There is also another table for sharing vehicles. This data is then synced to other database which keeps it in denormalised form: the PK is (ist_iid, vehicle_id) and the vehicles are duplicated to satisfy sharings. This make it easy to query; however we no longer can treat vehicle_id as unique, even though it is in certain sense.
I’m in the process of refactoring these synced tables and was wonder what I can do about this situation. I could leave it like this, but the PK can be annoying sometimes. On the other hand, the schema from main DB is even worse, as each query would require UNION and knowledge about how sharing works. How would you design schema in synced database? Explain why you choose it.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.