comparison | stored Procedure | performance | execution
Recently wrote a program to import IP and the region of the list of a plain text file into the database, the first use is to execute the INSERT statement directly with SqlCommand, and then know that SQL Server can optimize the stored procedures, eliminating the time to parse the statement, Faster than using INSERT statements directly. I put the INSERT statement in a temporary stored procedure, used this temporary stored procedure for the insert operation, and roughly tested the timing of the execution of the two.
INSERT into [Ipwry] VALUES (@StartIP, @EndIP, @Country, @Local)
This stored procedure is executed with SqlDataAdapter update, which is a total of 180,485 records.
The results are as follows:
The first second time the third average
Direct Insert 133 seconds 132 SEC 135 Second 133.3 sec
Stored procedure 121 seconds 122 seconds 120 seconds 121 seconds
Test environment: Windows Server 2003, SQL Server v8.0.818, Framework 1.1.4322 SP1 (Winform);
Pentium 4 2.0GHz, 512MB RAM
This result shows that executing a large number of INSERT statements with stored procedures is about 10% faster than executing the INSERT statement directly.
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.