title: Create an aggregate checksum of a column
body: <p>I want to compute a checksum of all of the values of a column in aggregate.</p>
  
  <p>In other words, I want to do some equivalent of </p>
  
  <pre><code>md5(group_concat(some_column))
  </code></pre>
  
  <p>The problem with this approach is:</p>
  
  <ol>
  <li>It's inefficient. It has to concat all of the values of the column as a string in some temporary storage before passing it to the md5 function</li>
  <li>group_concat has a max length of 1024, after which everything else will be truncated.</li>
  </ol>
  
  <p>(In case you're wondering, you can ensure that the concat of the values is in a consistent order, however, as believe it or not group_concat() accepts an order by clause within it, e.g. <code>group_concat(some_column order by some_column)</code>)</p>
  
  <p>MySQL offers the nonstandard bitwise aggregate functions BIT_AND(), BIT_OR() and BIT_XOR() which I presume would be useful for this problem. The column is numeric in this case but I would be interested to know if there was a way to do it with string columns.</p>
  
  <p>For this particular application, the checksum does not have to be cryptologically safe.</p>