Comparison of general data storage and bulk data storage--100,000 data

Source: Internet
Author: User

First, establish the student table in the database

Ii. creation of 100,000 data

Create Data

Iii. creating a general data storage method

 PublicStaticvoidSavegeneral (DataTable DT) {String strconn =@"Data Source=.;i Nitial catalog=test;integrated Security=true"; SqlConnection conn =NewSqlConnection (strconn); Conn. Open (); SqlCommand cmd =NewSqlCommand (); Cmd. Connection =Connfor (int i =0; i < dt. Rows.Count; I++) {string strSQL = insert into [Test]. [dbo]. [Student] VALUES ('  ' + dt. Rows[i][0 "+   " "+ dt. Rows[i][1 "+   " "+ dt. Rows[i][ ")  " Cmd.commandtext = strSQL; cmd. ExecuteNonQuery (); } conn. Close (); } 

Iv. Creating bulk storage data

To establish a mapping relationship between a data source and a destination storage data structure:

    

Relational Mappings

Create transaction Store bulk data:

    

Bulk Storage

Summarize:

There is a big difference in the time between the two storage methods.

My PC's configuration CPU 3.40GH identify memory 3.4G

Storing 10W data in general storage methods takes about 8 minutes and 57 seconds.

Takes approximately 1.9503 seconds to store 10W of data in a sqlbulkcopy batch

Comparison of general data storage and bulk data storage--100,000 data

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.