title: Jooq batch record insert
body: <p>I'm currently trying to insert in batch many records (~2000) and Jooq's batchInsert is not doing what I want. </p>
  
  <p>I'm transforming POJOs into UpdatableRecords and then I'm performing batchInsert which is executing insert for each record. So Jooq is doing ~2000 queries for each batch insert and it's killing database performance.</p>
  
  <p>It's executing this code (jooq's batch insert):</p>
  
  <pre><code>for (int i = 0; i &lt; records.length; i++) {
              Configuration previous = ((AttachableInternal) records[i]).configuration();
  
              try {
                  records[i].attach(local);
                  executeAction(i);
              }
              catch (QueryCollectorSignal e) {
                  Query query = e.getQuery();
                  String sql = e.getSQL();
  
                  // Aggregate executable queries by identical SQL
                  if (query.isExecutable()) {
                      List&lt;Query&gt; list = queries.get(sql);
  
                      if (list == null) {
                          list = new ArrayList&lt;Query&gt;();
                          queries.put(sql, list);
                      }
  
                      list.add(query);
                  }
              }
              finally {
                  records[i].attach(previous);
              }
          }
  </code></pre>
  
  <p>I could just do it like this (because Jooq is doing same thing internally):</p>
  
  <pre><code>records.forEach(UpdatableRecord::insert);
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>jooq.batchInsert(records).execute();
  </code></pre>
  
  <p>How can I tell Jooq to create new records in batch mode? Should I transform records into bind queries and then call batchInsert? Any ideas? ;)</p>