[Reprint] ERP Development-Data query optimization method

Source: Internet
Author: User

System operating Environment:
MSSQL 2008
With the rapid development of the company's business, a variety of business data such as rocket-like high-speed growth, one after another tens of thousands of rows of data tables, often large tables between the association, consuming a large number of disk IO system, and will affect the normal operation of the real-time business, so we must improve the way such queries, to ensure that the system
How is the association query optimized between large tables and large tables?
1 new indexed view, will need to show the associated data to establish a view, so that the query physical existence on the system,
CREATE VIEW TableView
With SCHEMABINDING
As select A.a1,a.a2,b.b1,b.b2 from a LEFT join B on a.ID =b.id
CREATE UNIQUE CLUSTERED INDEX ix_ tableview_id
On TableView (ID);
2 in the data table design, the use of redundant design, the associated table fields into a table, avoid large table association query.
3 in a database report query:
3.1 In the business design, as far as possible to achieve sub-period query, to avoid returning n years of data [because return n years, it is best to find DBA export]
3.2 In a stored procedure, first create a few temporary tables into the temporary table with data intercepted from the large table by query criteria
3.3 Using these temporary small tables to make the associated query, and to obtain the required data, you can avoid large table association queries.
4 Do the system cache design by the way of the program? This method is used with caution [as this can only do approximate statistics---BI].

Postscript:
In the case of Slow program, the first must check the program's optimization space, as far as possible from the software to solve the problem, to avoid problems on the replacement of hardware, or seek help, remember, avoid!

Transfer from http://www.maomao365.com/?p=469

[Reprint] ERP Development-Data query optimization method

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.