KNN search two arrays with 2000 elements
You have one option, you can recompile the cube extension to use more than 100 dimensions

KNN Search is done with PostGIS using the &lt;-&gt; operator on two points. You can find out how to do that in the docs.. It doesn't operate in Nd-space. PostGIS isn't an abstract library for math. It's for real world geospatial problems. KNN in 1d, and 4d+ is not a real world problem, or at least not in the domain that PostGIS would be interested in.

I would suggest checking out my other answer here,


Searching in n-dimensional space