0

For this question I consider applications select and use columns by name (so I am excluding use of select * as a breaking change).

Asked in a different way, is it the case that once a Database schema is in 4NF then any change that needs to be applied to it should only be an "additive" change and therefore not break any existing applications that use it?

For me I am discounting some obvious changes:

  • Drop column (This change can be held back and only applied once all uses of the column are no longer active)
  • Drop table (Same as drop column)

For me I am considering "additive" changes as non-breaking:

  • Add column
  • Add table
  • Denormalisation (Add column + whatever triggers etc are required)

For me the "Refactoring" change that would break applications is to alter a columns datatype (e.g. Change from INTEGER to VARCHAR type)

What other changes can be made to a schema in 4NF that will break applications using that schema?

UPDATE: Currently we have:

  • Changing the data type in a breaking way (INTEGER -> VARCHAR)
  • Adding a constraint (or tightening an existing constraint)

Q: Are there any schema design changes that can take a design from 4NF into a different 4NF design?

7
  • I'm guessing this question is a hypothetical or thought experiment, as it doesn't seem to have much of a real world bent to it. I guess it could also be a job interview question to see if people understood normalization or theory. I'm trying to understand the useful, real-life situation where this question has any meaning other than what I have guessed here. So learning is good, but that's not what Stack is supposed to be used for. Commented Apr 5, 2016 at 14:35
  • @Karen Lopez Yes you could say it is a thought experiment specifically related to the push towards "microservices" in software development (and how that pertains to Database design). My thought is there is significant push (from "microservices" architecture) towards totally independent databases for each microservice. This can have significant negative impact on database design / loss of constraints etc. Commented Apr 5, 2016 at 21:56
  • I might be re-writing history a bit here but back 20 years ago (client server days for me) Database designers were a significant part of the development team and databases were 'designed' with a relatively holistic enterprise view. Fast forward and it seems to me that Database designers are not as involved for some reason. It might be just my experiences but DB Designers and DBA's are often not prominent when "interesting" architectural decisions are made. Commented Apr 5, 2016 at 22:02
  • As I see it many "software architects" pushing for "microservices architecture" do not have faith in 4NF. Their solution is to abstract away from the database schema (absolutely no matter the cost). This can have pretty major implications. My thought is that for some reason over the last 20 years development teams have "lost faith in 4NF" and my question is if that is valid (because I've seen fairly large $$ go to what I think bad architectural decisions). Commented Apr 5, 2016 at 22:12
  • For software developers everything is changeable in a breaking fashion. To mitigate this the answer is to define an abstract interface (to enable the implementation can change without breaking the caller etc). The concept that a non-abstract design (DB schema where all the tables are in 4NF) can be relied upon by an application to not change in a breaking fashion is a large conceptual leap for some "software architects" Commented Apr 5, 2016 at 22:24

1 Answer 1

2

Most changes are "breaking" if you aren't careful. Any change to code for example (you mentioned triggers). Any new or modified constraints, calculated columns etc.

You could even add a new index and effectively "break" your application because a query that used to run sub second now runs in seconds, minutes, even hours because the query plan has changed.

Assuming your code is written to always specifically name columns will probably make adding new columns reasonably safe and adding a table almost always is but you still probably want to test how each change to your database affects your application and it's performance.

13
  • Thanks. I am looking for specific changes to the logical model that will stop an application from working . What that means is that "Adding columns (derived or not)" I don't consider a breaking change. Similarly I do not consider adding an index a breaking change. Similarly when we say "Add a trigger" why would that break an application - I wouldn't expect that to be the case so can you give an example for that? Commented Apr 4, 2016 at 22:21
  • Ultimately I'm looking to answer the question of what cases a schema can go from 4NF to a another different 4NF schema? (because I don't think it can by definition of Normalization/4NF). UPDATE: It might be best to ask that question explicitly as a separate question. Commented Apr 4, 2016 at 22:24
  • Example of adding a trigger that can cause an application to break : A trigger with a bug, a trigger that takes a long time, etc. Note: The change of normalization really doesn't affect an application one way or the other. Commented Apr 5, 2016 at 0:38
  • Again I'm excluding performance so that excludes "a trigger that takes time". That leaves us with "A trigger with a bug". Commented Apr 5, 2016 at 0:49
  • Note: The change of normalization really doesn't affect an application one way or the other. Can you elaborate what you mean by that? Going from 3NF to 4NF I'd expect to break an application - we want to get to 4NF for a reason and specifically the only changes from there SHOULD be denormalization (or 5NF). So no I do not understand your comment there. Commented Apr 5, 2016 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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