title: How to copy data from a Cassandra table to another structure for better performance
body: <p>In several places it's advised to design our Cassandra tables according to the queries we are going to perform on them. In <a href="http://datascale.io/cassandra-data-model-basics/" rel="noreferrer">this article by DataScale</a> they state this:</p>
  <blockquote>
  <p>The truth is that having many similar tables with similar data is a good thing in Cassandra.  Limit the primary key to exactly what you’ll be searching with.  If you plan on searching the data with a similar, but different criteria, then make it a separate table.  There is no drawback for having the same data stored differently. Duplication of data is your friend in Cassandra.</p>
  <p>[...]</p>
  <p>If you need to store the same piece of data in 14 different tables, then write it out 14 times. There isn’t a handicap against multiple writes.</p>
  </blockquote>
  <p>I have understood this, and now my question is: provided that I have an existing table, say</p>
  <pre><code>CREATE TABLE invoices (
      id_invoice int PRIMARY KEY,
      year int,
      id_client int,
      type_invoice text
  )
  </code></pre>
  <p>But I want to query by year and type instead, so I'd like to have something like</p>
  <pre><code>CREATE TABLE invoices_yr (
      id_invoice int,
      year int,
      id_client int,
      type_invoice text,
      PRIMARY KEY (type_invoice, year)
  )
  </code></pre>
  <p>With <code>id_invoice</code> as the partition key and <code>year</code> as the clustering key, <strong>what's the preferred way to copy the data from one table to another</strong> to perform optimized queries later on?</p>
  <p>My Cassandra version:</p>
  <pre><code>user@cqlsh&gt; show version;
  [cqlsh 5.0.1 | Cassandra 3.5.0 | CQL spec 3.4.0 | Native protocol v4]
  </code></pre>