2

Let's say I have this database

client
| id | status |

sale
| id | client_id | date |

sale_item
| id | sale_id | *client_id* |

The *client_id* column is redundant, because we can JOIN and get client from sale_item rows. However, if I'd often need to list sales by client, that JOIN could be expensive.

Is this considered denormalization? Or does it have another technical name?

In my understanding the decision to keep *client_id* is about space x speed. Consistency problems introduced by common denormalization examples doesn't apply here because id will never change neither be deleted (if we need to "remove" we can just set status=0).

3

Yes, it is denormalization. Any time you're copying data from one location in a database to another location (where the data could easily be obtained from its original location), it's denormalization by definition.

And, improving performance is a perfectly good reason to denormalize. That said, unless you have a huge number of clients, or the client_id is the only data from the sale table that you would normally need, then it shouldn't be a major concern. It's entirely reasonable to cause this particular instance of denormalization "cascading key structure", or anything else appropriate. Doesn't mean it's not also denormalization.

And, with respect to not having consistency issues - never say never....

  • 1
    This guy called it "cascading key structure" but from what I searched it's another thing. – rodorgas Jun 5 '17 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.