savv'y
savv'y

Reputation: 219

Multiple vs Single Table

I have an issue different from the questions already on stackoverflow.

We have two entities representing "Foo USA" and "Foo World", while the columns of Foo are exactly the same in both the tables, there would not be a scenario where these two tables would need to be joined and retrieved, they are completely independent of each other by their definition.

Does it make sense to keep two tables separate only because they define two exclusive entities? Or should I have one single table which has a column defining if it belongs to USA or World?

Does keeping the data in small independent tables yield better performance?

Please help and thanks for looking.

Upvotes: 0

Views: 106

Answers (1)

Lucas
Lucas

Reputation: 1231

Keeping the data in small independent tables might yield better performance, but it may not be noticeable depending on the expected size of the table. Unless you are expecting hundreds of millions of records there shouldn't be any issue using a single table assuming you have indexes as needed.

A single table would be preferred from a development point of view just because everything becomes the same and you only have to write and maintain one query when accessing data. You don't have to worry about forgetting to include both. It would be easier to maintain from that sense.

With that said if the USA portion of your system has noticeable differences than the WORLD portion that would be an argument for keeping them separate.

If not and its not a lot of effort to put them into the same table now then you should consider merging them now. It is likely worth doing and will probably save you time in the long run and possibly even prevent a few bugs.

Upvotes: 3

Related Questions