I want to store thousands of ~100 element vectors in a database, and then I need to search for the record with the smallest difference.
e.g. when comparing [4,9,3]
and [5,7,2]
, take the element-wise diff: [-1,2,1]
and then compute the Euclidean length: sqrt(1+4+1) = 2.45.
I need to be able to search for the record containing this lowest value.
I don't think I can do efficiently in MySQL. I hear Solr or Elastisearch might provide a solution; can someone point me towards or post an example of how this kind of search can be done (efficiently)?