0

What I did:

  1. installed postgresql 9.3.1
  2. installed postgis 2.1.2
  3. I tried to find the distance by selecting column input_variable_1 with value 50.

I got the following result.

select input_variable_1 <-> 50  as distance  from test_ata limit 10; distance        48        2       17       29       44       37       45       17       49        2(10 rows)

what i want:

input: column which stores array values say 2000 elements in a single record.

I came across cube extension and postGIS there i can get distance between two points by using tree and distance concepts for lower dimentsions upto 100.

  1. How to find the distance between two arrays having elements atleast 2000 in postgresql?
  2. which tree is best for 2000 dimension indexing in postgresql?
  3. finally i want to know how to use KNN search in postgresql?
Erwin Brandstetter's user avatar
Erwin Brandstetter
187k28 gold badges465 silver badges639 bronze badges
askedMar 23, 2017 at 14:15
harishankar's user avatar

1 Answer1

0

You have one option, you can recompile thecube extension to use more than 100 dimensions

KNN Search is done with PostGIS using the<-> operator on two points. You can find outhow 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,

answeredMar 23, 2017 at 17:08
Evan Carroll's user avatar
1
  • 1.first convert your array into cube(array) 2.apply cube_distance to the converted array 3.apply sorting u may get nearest valuesCommentedMar 31, 2017 at 11:39

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.