title: Table just for grouping
body: <p>Is it a common case to have a table with a single column for the purpose of grouping rows in another table?</p>
  
  <p>I'm inserting data in batches and I want to have an autoincrement key for each batch to be able to group data based on generated id.</p>
  
  <p>Concretely I want to get from this</p>
  
  <pre><code>A
  id, x, y, b_id
  id PRIMARY KEY
  b_id FOREIGN KEY REFERENCES B.id
  
  B
  id, timestamp
  id PRIMARY KEY
  
  SELECT count(*) as number, B.timestamp FROM A inner join B on A.b_id=B.id
                       where A.x='value' and A.y='value'
                       group by B.id;
  </code></pre>
  
  <p>to</p>
  
  <pre><code>A
  id, x, y, timestamp, b_id
  id PRIMARY KEY
  b_id FOREIGN KEY REFERENCES B.id
  
  B
  id
  id PRIMARY KEY
  
  SELECT count(*) as number, A.timestamp FROM A
                           where A.x='value' and A.y='value'
                           group by A.b_id, A.timestamp;
  </code></pre>
  
  <p>So basically move timestamp to B (denormalize) and use foreign key only for grouping. I want to avoid having join only for the timestamp placed in B. Tables are quite big (60M of rows) and join is very slow. If I still filter on A and have foreign key only for grouping then that would speed up things a lot.</p>
  
  <p>Concretely, I'm using MySQL.</p>