SELECT a.pk, b.pk, c.pk, d.name FROM a JOIN b on b.pk = a.fk JOIN c on c.pk = b.fk JOIN d on d.pk = c.fk
I can do
SELECT a_pk, b_pk, c_pk, d_name FROM view_a_b_c_d
I have a lot of this sort of thing through my code.
I’ve done a performance test, and the differences seem to be negligible, and I feel it would greatly tidy my codebase up and remove a lot of repetition.
But before I commit to that (as it’d be a big change with a lot of work and testing), I want to check that this IS a good thing to do. I didn’t study computer science and have no formal DBA training. I’m also a sole dev working on my own closed-source product. So I don’t get much input from the outside world, unless I strike out and ask for it.
Thank you – any opinions/experience appreciated.