I've run across this issue several times of late, and I've never come up with
a satisfactory answer to the best way to handle this schema issue. You have a
large section of schema in which a subset of records across all tables is
often considered a separate logical system, but sometimes may be treaded ar
part of the global system, and there is not simply a 1-m-m... tree among the
records in a logical database.
Here's an example. A system that was originally designed to handle only data
for a single company is now handling data for multiple companies. So, the
simplest concept to implement would be to simply add CompanyID to all the
tables, and include that in all the relationships between the tables.
Somehow, that's not very satisfying.
One obvious problem with this is that among the tables with the largest number
of rows, adding a column is a big cost in size. These are mostly subdetail
records, so one would think it would work to simply rely on the parent
record's CompanyID, but wait - The detail table references lookup tables that
are also company-specific. If the CompanyID is omitted from the table, there
is no way to have the relationship enforce that all the related records belong
to the same company. One can rely on the application to do that, but this
leaves some danger of integrity problems when manual table maintenance is
performed.
Has anyone come up with a better strategy for handling these kinds of designs?
a satisfactory answer to the best way to handle this schema issue. You have a
large section of schema in which a subset of records across all tables is
often considered a separate logical system, but sometimes may be treaded ar
part of the global system, and there is not simply a 1-m-m... tree among the
records in a logical database.
Here's an example. A system that was originally designed to handle only data
for a single company is now handling data for multiple companies. So, the
simplest concept to implement would be to simply add CompanyID to all the
tables, and include that in all the relationships between the tables.
Somehow, that's not very satisfying.
One obvious problem with this is that among the tables with the largest number
of rows, adding a column is a big cost in size. These are mostly subdetail
records, so one would think it would work to simply rely on the parent
record's CompanyID, but wait - The detail table references lookup tables that
are also company-specific. If the CompanyID is omitted from the table, there
is no way to have the relationship enforce that all the related records belong
to the same company. One can rely on the application to do that, but this
leaves some danger of integrity problems when manual table maintenance is
performed.
Has anyone come up with a better strategy for handling these kinds of designs?
Comment