MySQL big data warehouse receiving (single table) has been studying data warehouse receiving recently. For the INSERT command, a small amount of data can be satisfied, while for a large amount of data to be inserted into the same table, the speed is very slow, obviously does not meet the requirements. So I found it from the Internet. MYSQL has a LOAD DATA INFILE command. Here is a brief description of the role of load data infile: It mainly records the files into tables in batches, the speed is very fast. However, operations can only be performed on one table. That is to say, all records are in one table, which has certain limitations. MYSQL connection string:
m_pConnection->Open("DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost; DATABASE=test;","root","123456",adModeUnknown);
{MySQL ODBC 5.1 Driver} is the ODBC Driver of MySql. It is downloaded from the official website. Version 5.1 is the IP address of the computer installed in mysql. If it is local, use localhost. DATABASE is the DATABASE to be connected. In the Open method, "root" indicates the database username "123456" indicates the user password. Test procedure: 1. Create a database test 2. Execute the following database script in this database
CREATE TABLE T_TEST( F_ID BIGINT PRIMARY KEY, F_NAME VARCHAR(32), F_SEX SMALLINT, F_BIRTHDAY DATETIME, F_CONTENT VARCHAR(512));
3. Make sure that the T_TEST table is empty when executing the program. 4. The test result is that 10 million pieces of data can be stored in the database around 1 s.