Brief Introduction to database creation view Efficiency

Source: Internet
Author: User

A Brief Introduction to the efficiency of creating a database view the main purpose of creating a view is to facilitate data query, but not to improve the query efficiency. To improve the efficiency, you can only optimize it through other methods, for example, creating an index. The following statement proves that the average data is queried by day. The data volume is 0.58 million select avg (ave_value) ave_value, to_date (CONCAT (to_char (create_time, 'yyyy-mm-dd'), '00:00:00 '), 'yyyy-mm-dd hh24: mi: ss') create_time from PDB_NWD_CPUM_D group by to_char (create_time, 'yyyy-mm-dd'); time consumed: create a view under 0.422 seconds and create view PDB_NWD_CPUM_D_DAY as select avg (ave_value) ave_value, to_date (CONCAT (to_char (create_time, 'yyyy-mm-dd'), '00:00:00 '), 'yyyy-mm-dd hh24: Mi: ss ') create_time from PDB_NWD_CPUM_D group by to_char (create_time, 'yyyy-mm-dd'); after the view is created, we query this view: select ave_value, create_time from PDB_NWD_CPUM_D_DAY; the query efficiency was not improved when it took more than 0.429 seconds to run several times. Of course, if you create a view for multiple tables, it will reflect the advantages of the view-convenience.
 

Related Article

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.