title: MySql Insert Ignore performance
body: <p>I have to insert 90Mb of data into MySql Tables and I'm using INSERT IGNORE command to avoid the exception of duplicate key. The performance are 8 records a second but it seems very slow. Could I fast it up?</p>
  
  <p>p.s. I'm inserting record per record since i read data from an sql compact database</p>
  
  <pre><code>using (SqlCeConnection sqlConnection = new SqlCeConnection(connectionstrCe))
              {
                  sqlConnection.Open();
                  SqlCeCommand cmdCe = sqlConnection.CreateCommand();
                  {
                      {
  
                          mySQLConnection.Open();
  
                          foreach (KeyValuePair&lt;string, List&lt;string&gt;&gt; t in tablesCeNames) //reading the tables property from the dictionary - column names and datatypes
                          {
  
                              string tableData = t.Key; 
                              List&lt;string&gt; columnData = t.Value;
  //get the values from the table I want to transfer the data
                                  cmdText = "SELECT * FROM " + tableData;
  //compose the mysql command
                                  cmdCe.CommandText = cmdText;
  
                                  SqlCeDataReader dataReader = cmdCe.ExecuteReader(); //read
  //InsertTable is a method that get the datareader and convert all the data from this table in a list array with the values to insert
                                  inputValues = InsertTables(dataReader);
  
  
                                  MySql.Data.MySqlClient.MySqlTransaction transakcija;
                                  transakcija = mySQLConnection.BeginTransaction();
  
                                  worker.ReportProgress(4, inputValues.Count);
  
                                  foreach (string val in inputValues)//foreach row of values of the data table
                                  {
                                      cmdSqlText = "INSERT IGNORE INTO " + tableData + "("; //compose the command for sql
  
                                      foreach (string cName in columnData)  //forach column in a table
                                      {
                                          string[] data = cName.Split(' ');
                                          if (!data[0].ToString().Equals("Id"))
                                          {
                                              cmdSqlText += data[0].ToString() + ","; //write the column names of the values that will be inserted  
                                          }
                                      }
                                      cmdSqlText = cmdSqlText.TrimEnd(',');
                                      cmdSqlText += ") VALUES (";
  //val contains the values of this current record that i want to insert
                                      cmdSqlText += val;  //final command with insert ignore and the values of one record
                                      if (!val.Equals(""))
                                      {
                                          try
                                          {
                                              new MySql.Data.MySqlClient.MySqlCommand(cmdSqlText, mySQLConnection, transakcija).ExecuteNonQuery(); //execute insert on sql database
                                              WriteToTxt("uspješno upisano u mysql" + t.Key);
                                          }
                                          catch (MySql.Data.MySqlClient.MySqlException sqlEx)
                                          {
                                          }
                                      }
                                  }
  
                                  if (TablicaSveOK)
                                  {
                                      transakcija.Commit();
  
                                  }
                                  else
                                  {
                                      transakcija.Rollback();
                                  }
                              }
                          }
  
                          if (mySQLConnection.State != System.Data.ConnectionState.Closed)
                          {
                              mySQLConnection.Close();
                          }
                      }
  </code></pre>