Can not be discounted view of the impact of efficiency
Recently for the development of an enterprise database applications. There are two data tables: A and B, where A records for about 20,000, and B of the data for more than 2 million, now requires a.id = b.id related data for screening.
This request, I made a view View1, a.id and b.id Association, the view on the operation, the use of the two seconds on the outcome. Then have a special needs: the preparation process of storage, the storage process in the cycle of a cursor, and the cycle repeated 10,000 times, in each cycle of use of View1 enquiries, for example as follows:
Circulation of the cursor (repeated 10,000 times)
(
@ Text = select text from view1 where id = @ id - which text @, @ id variables are
Update form1 set text text where id = @ @ id =
)
Carrying out the above storage process, was found to spend> 7 minutes computing time that an analysis of the efficiency of the entire loss in the view of view1 scanning, although the view of the separate inquiries only two seconds, but in this circumstances that require too much time.
Therefore improve the storage process is as follows:
Create table # tempTab
(
Id nvarchar (20),
Text nvarchar (20)
)
Enquiries View1 view, will be inserted into the record # tempTab temporary table …
Circulation of the cursor (repeated 10,000 times)
(
Select text from text = @ # @ tempTab where id = id - which text @, @ id variables are
Update form1 set text text where id = @ @ id =
)
Other ranking officials over changes at the storage process only spend 50 seconds of time.
For this phenomenon, as follows: in the view of many a cycle of inquiries, there will be a significant amount of time, to view data on the memory of the increase will be calculated speed.
If you have any suggestions, please return, and discuss this.
Tags: efficiency








0 Comments to “Can not be discounted view of the impact of efficiency”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.