title: How to insert 40000 records fast into an sqlite database in an iPad
body: <p>I want to insert 40000 records that i get from a web service into a sqlite database in my iPad app.</p>
  
  <p>I wrote the following code, but it takes around 20 minutes, is there a faster way?</p>
  
  <pre><code>- (NSArray *)insertPriceSQLWithPrice:(Price *) price
  {
  
  SQLiteManager *dbInfo = [SQLiteManager sharedSQLiteManagerWithDataBaseName:@"codefuel_catalogo.sqlite"];
  
  
  sqlite3 *database;
  
  NSString *querySQL=[self formatStringQueryInsertWithTable:@"prices_list" andObject:price];
  
  
  if(sqlite3_open([dbInfo.dataBasePath UTF8String], &amp;database) == SQLITE_OK)
  {
      sqlite3_stmt * compiledStatement;
  
  
      const char *query_stmt = [querySQL UTF8String];
  
      int result = sqlite3_prepare_v2(database, query_stmt, -1, &amp;compiledStatement, NULL);
  
      if (result == SQLITE_OK)
      {
          int success = sqlite3_step(compiledStatement);
  
          NSLog(@"el numero de success es -&gt; %i",success);
          if (success == SQLITE_ERROR)
              NSLog(@"Error al insertar en la base de datps");
  
      }
      else
          NSLog(@"Error %@ ERROR!!!!",querySQL);
  
      sqlite3_finalize(compiledStatement);
  }
  
  sqlite3_close(database);
  return nil;
  }
  </code></pre>