vincent15000's avatar

Some questions about using a MySQL view

Hello,

I think about using a MySQL view to select data from different tables and then to be able to display them more easily in blade view.

I never used any MySQL view, so I don't know how it really works.

I have read that when using MySQL views, each request takes some more time to be done.

Is it really a good idea to use MySQL views ? Does the MySQL view refresh entirely for each update in the database (I mean if the update is binded to the view) or does it refresh only for the concerned data ?

Using a MySQL view, that also means that the data are directly manpulated by MySQL to fill the view and not from a query inside Laravel. But is there a real difference between both ways ? I don't really think that there could be a problem with integrity, but it's new for me, so there are many questions in my head ;).

If you have an advice, thank you ;).

Vincent

0 likes
2 replies
Tray2's avatar
Tray2
Best Answer
Level 74

Using a database view is a good idea. It doesn't affect performance since it's handled inside the database. A view is a query that you query against, just as when using an inline view but instead of defining it in your sql you define it as an object in the database.

You can read more about them here https://tray2.se/posts/database-design-part-2

2 likes
vincent15000's avatar

@Tray2 Hello, your post on your website is really very very interesting ... thank you very much ;).

Please or to participate in this conversation.