Is a MySQL view faster than a normal query?

后端 未结 2 1640
栀梦
栀梦 2021-02-11 18:04

I have a complex query using many joins (8 in fact). I was thinking of simplifying it into a view. After a little research I can see the benefits in simplicity and security. But

2条回答
  •  渐次进展
    2021-02-11 18:38

    It can sometimes help, but it's no silver bullet. I've seen a view help performance, but I've also seen it hurt it. A view can force materialization, which can sometimes get you a better access path if MySQL isn't choosing a good one for you.

提交回复
热议问题