Skip to main content
Removed references to "effective partitioning (sharding)" as that is not what the user is doing.
Link
Aaron Bertrand
  • 181.5k
  • 28
  • 402
  • 619

Does effective partitioning (sharding) sometimes require denormalization?

Source Link

Does effective partitioning (sharding) sometimes require denormalization?

Specific example of what I'm asking:

Say that a SaaS app has an Order table with CustomerID and a child OrderItem table.

We want to partition both tables and we want to use CustomerID as the partition key.

The issue is that the OrderItem table does not have a CustomerID column (its only foreign key is to the Order table).

Would it be a best-practice to denormalize the OrderItem table and add a CustomerID column to it for the sake of partitioning?