Atitit Best Practice Attilax Summary of data storage views

Source: Internet
Author: User
Tags sql using

Atitit Best Practice Attilax Summary of data storage views

1.1. View benefits: Improved readability 1

1.2. conclusion in the principle of readability over performance, human-oriented programming takes precedence over machine-oriented programming and should be prioritized using views 2

1.3. Disadvantages of views: complex views can sometimes lead to performance degradation by 3

1.1. View benefits: Improved readability

The main functions of the view are the following points:
Focus: Make users care only about certain data that interests them and the specific tasks they are responsible for
Simplified Operation: If the view itself is a result set of a complex query, you do not have to re-write these complex query statements each time you execute the same query

Custom data: Views enable different users to see different or identical datasets in different ways

Merge split data: Because the data in the table is too large, the table is often designed to split the tables horizontally or vertically, but the change in the structure of the table has a bad effect on the application.

Security: Users can view and modify only the data they see through the view

1. You can access a subset of the columns in the table. Some columns in the table are sensitive data that you do not want users to see, such as user passwords, employee salaries, and so on, to hide these columns with views.

2. you can access a subset of the rows in the table. Sometimes you do not want to let users see the data that is not related to TA , you can filter in the where condition, such as employees of subsidiaries in enterprises can only see ta Colleagues in the subsidiary, and do not want other subsidiaries of the staff information is also displayed, with the filtered query out of the data set to form a view.

3. You can rename the column name. Some column name definitions in the table do not represent meaning, such as column "abc", in order for the user to see the column name to know what the column is, you can rename the column name when you build the view.

4. You can quickly access data composed of two or more table connections. Sometimes you want to access data sets made up of inter-table joins, and you can define the data set that is queried to be a view that can help you quickly access the data you need.   

  simplicity. Views not only simplify the user's understanding of the data, they can also simplify their operations. Those queries that are used frequently can be defined as views, so that users do not have to specify all the conditions for subsequent operations each time.  

Security. Users can only query and modify the data they see through the view. Other data in the database is neither visible nor can be taken. The database Authorization command enables each user to limit the retrieval of a database to a specific database object, but not to a specific row or column on a database. With views, users can be limited to different subsets of the data.  

logical data independence. Views enable applications and database tables to be somewhat independent. If there is no view, the application must be built on the table. With a view, the program can be built on top of the view so that the program is separated from the database table by the view.  

The view also has some drawbacks, mainly as follows.  

Performance:SQL Server must turn the query of the view into a query on the base table, if the view is defined by a complex multi-table query, then even a simple query of the view,sql The Server also turns it into a complex combination that takes some time.  

Modify limit: When a user attempts to modify some rows of a view,SQL Server must convert it to some row of the base table. This is convenient for simple views, but it can be non-modifiable for more complex views.  

5. you can quickly read the data set returned by the aggregation function operation. Sometimes users want to read the result set after the complex operation of the aggregate function, each read is very time-consuming, at this time can be the operation of the data set to form a view, you can avoid each read to the operation of the consumption.

In general, the use of views improves security and speeds up queries.

1.2.Conclusion  based on the principle of readability over performance, human-oriented programming takes precedence over machine-oriented programming and views should be prioritized

, you should weigh the pros and cons of the view and define the view reasonably

The trend of software history is a process of improving readability. Performance issues Hardware Remedy: Considering performance issues is actually a compromise in a realistic scenario.

1.3. Disadvantages of Views: complex views can sometimes lead to performance degradation

the pros and cons of SQL using views -Xiao_mege 's blog - netease blogs . html

author :: nickname : Old Wow's paw claw of Eagle Idol wreck Iconoclast Image-smasher

King of Bird Catcher King of Kings devout pious religious defender Defender of /c6> the Faith caracalla red cloak Caracalla red cloak

abbreviation:: Emir attilax Akbar Emile Atiraca

Full Name::Emir attilax Akbar bin Mahmud bin Attila bin Solomon bin Adam Al Rapanui  Emir Attilax Akbar ben Mahmud   ben Attila Solomon Ben Adam   al  Rapa Nui

Common name: Etila (Ayron), email:[email protected]

title:Head of Uke headquarters, founder of Global Grid project,

Uke, Minister of Religious and Cultural Integration Affairs, Vice-Chairman of the Uke Reformation Commission

, Chief chieftain of the Uke tribe,

Uke system and chairman of the major conference committee, Uke Security Department Chief Brigade, Uke System Inspection Committee vice President,

CTO of Dairy Technology , chief CTO of Uke

Uke Polynesia District chain head, Kerr Glenn Islands district chain head, Line Is. district chain head, uke Tonga Kingdom regional head. Bouvet and South Georgia and South Sandwich Is. regional chain head

Uke, chairman of the Association of Software Standardization Uke, vice President of lifelong Education School

Uke, vice president of the Association of Database and Storage standardization, editor of Uke Publishing house

Founder of Uke Hospital

reprint Please indicate source:Attilax's column? http://www.cnblogs.com/attilax/

--atiend

Atitit Best Practice Attilax Summary of data storage views

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.