title: Is a relational database well suited for vector calculations?
body: <p>The basic table schema looks something like this (I'm using MySQL BTW):</p>
  
  <p><code>
  integer unsigned <b>vector-id</b>
  <br>integer unsigned <b>fk-attribute-id</b>
  <br>float <b>attribute-value</b>
  <br>primary key (<b>vector-id</b>,<b>fk-attribute-id</b>)
  </code></p>
  
  <p>The <i>vector</i> is represented as multiple records in the table with the same <b>vector-id</b></p>
  
  <p>I need to build a separate table with the dot product (also euclidean distance) of all vectors that exist in this table.  So, I need a result table that looks like this:</p>
  
  <p><code>
  integer unsigned <b>fk-vector-id-a</b>
  <br>integer unsigned <b>fk-vector-id-b</b>
  <br>float <b>dot-product</b>
  </code>
  <br><br>...and one like this...
  <br><br>
  <code>
  integer unsigned <b>fk-vector-id-a</b>
  <br>integer unsigned <b>fk-vector-id-b</b>
  <br>float <b>euclidean-distance</b>
  </code></p>
  
  <p>What is the best query structure to produce my result?</p>
  
  <p>With very large vectors, is a relational database the best approach to solve this problem, or should I internalize the vectors in an application and do the calculation there?</p>