The system I'm dealing with day-to-day right now is full of nested views. 😜
It's really hard to figure what's going on!
I think readability and being able to reason about what's going on is another big benefit to using staging tables as you mentioned.
Something I remember from database 101 is to limit your use of cursors. In my first job, there were cursors everywhere. An easy fix for these, if they tended to cause issues, was to just do something other than use cursors 😋.
Great article! 🤜🤛
Thank you James :)
I'm also finding it really hard to untangle nested views right now. I know there is a column I need from somewhere down through the spaghetti mess but it's getting harder and harder to split that out from the noise around it.
I'm learning more and more that it's important to reassess why views are important and if they are so important, why they aren't a table in their own right.
The more I delve into databases in the real world the more pragmatic I become, but at the same time know things could be better
I think that's exactly why more senior devs tend to lean on the "keep it really simple" side of the spectrum. We've had first-hand experience with what happens when you don't!
I find most times the culprit is an attempt to make everything "re-usable". But whether it's database code or back-end code, etc. that's a principle that shouldn't be pushed so hard.
I'd much rather deal with the same logic copied and pasted in 3 different places than 3 levels of nested views, etc.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.