Is it good to build a view model in the code model layer or to build a view in a database?
Reply content:
Is it good to build a view model in the code model layer or to build a view in a database?
Better than the model
Looking at the needs and teams, if there is a DBA, it makes the process more comfortable in the database because it abstracts a layer of logic and can improve reusability if well designed
I'll find out by comparison. In the model layer do view developers can intuitively understand the view, and can be modified as required at any time Making a view of the database simplifies the business logic, but the maintenance of the view takes additional manpower
In fact, like the model has aftersave beforesave such hooks, database also has a trigger, which is good? Almost, the former is transparent, well maintained, while the latter simplifies logic and is more efficient.
Also consider the database you are using, the view data of the database such as Oracle,sqlserver is cached, the query from the view is much faster than using the table connection query, but the MySQL view data is non-cached and there is no performance improvement.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.