Why is using '*' to build a view bad?

后端 未结 14 2169
执念已碎
执念已碎 2020-11-27 07:02

Why is using \'*\' to build a view bad ?

Suppose that you have a complex join and all fields may be used somewhere.

Then you just have to chose fields needed

14条回答
  •  迷失自我
    2020-11-27 07:59

    Using '*' for anything production is bad. It's great for one-off queries, but in production code you should always be as explicit as possible.

    For views in particular, if the underlying tables have columns added or removed, the view will either be wrong or broken until it is recompiled.

提交回复
热议问题