title: Saving small amount of data is slower than saving big amounts of data in CassandraDB
body: <p>I have this weird problem - given the below two models:</p>
  
  <pre><code>[Table(Name = "pretty_fast_table", Keyspace = "funky_stuff")]
  internal class PrettyFastTable
  {
      [Column(name: "message_number")]
      [PartitionKey]
      public long MessageNumber { get; set; }
  
      [Column(name: "time_stamp")]
      [ClusteringKey]
      public DateTime TimeStamp { get; set; }
  
      [Column(name: "some_value")]
      public decimal SomeValue { get; set; }
  
      [Column(name: "is_a_cool_entry")]
      public bool IsACoolEntry { get; set; }
  }
  
  [Table(Name = "pretty_slow_table", Keyspace = "funky_stuff")]
  internal class PrettySlowTable
  {
      [Column(name: "message_number")]
      [PartitionKey]
      public long MessageNumber { get; set; }
  
      [Column(name: "some_other_value")]
      [ClusteringKey]
      public decimal SomeOtherValue { get; set; }
  
      [Column(name: "some_other_other_value")]
      public decimal? SomeOtherOtherValue { get; set; }
  
      [Column(name: "percentage")]
      public decimal Percentage { get; set; }
  
      [Column(name: "count")]
      public int Count { get; set; }
  
      [Column(name: "my_value")]
      public decimal MyValue { get; set; }
  }
  </code></pre>
  
  <p>Writing 500 000 entries into <code>PrettyFastTable</code> takes &lt; 1 minute. Writing 500 000 entries into <code>PrettySlowTable</code> often taken > 8 minutes. Code I'm using to write both types of entries is below:</p>
  
  <pre><code>public async Task ExecuteAsync(IEnumerable&lt;T&gt; partition, long partitionKey)
  {
      var entitiesArr = partition.ToArray();
  
      var size = calculatedBatchSize;
      var groups = entitiesArr
          .Select((item, idx) =&gt; new {item, idx})
          .GroupBy(x =&gt; x.idx / BatchSize)
          .Select(g =&gt; g.Select(x =&gt; x.item));
  
      await BatchInsertAsync(groups, partitionKey);
  
      break;
  }
  
  private async Task BatchInsertAsync(IEnumerable&lt;IEnumerable&lt;T&gt;&gt; groups, long partitionKey)
  {
      foreach (var group in groups)
      {
          var batch = new BatchStatement();
          var groupArr = group.ToArray();
  
          batch.SetBatchType(BatchType.Unlogged);
          batch.SetRoutingValues(partitionKey);
  
          foreach (var entry in groupArr)
          {
              batch.Add(_table.Insert(entry, false).SetTTL(TTL));
          }
  
          await _session.ExecuteAsync(batch);
      }
  }
  </code></pre>
  
  <p>The only difference is that the <code>IEnumerable&lt;PrettyFastTable&gt;</code> partition will usually be much bigger than the other one. I don't get it - why is it so slow?</p>
  
  <p>My Cassandra cluster consists of 3 nodes and as for the configuration stuff, it's basically the default one.</p>