   Nearest point find in 3d points in DB
  I have values in database of points x ,y z.I need to find the nearst point in databse with my current points i implement this algorithm but its take lots of time i want efficent algorithmNote:(this algorithm is same as find smallest number in array)nearstdistance=firstdistance in db valuesloop (untill all values in databse)  find distance between current points and current databse pointsif distance<nearesrdistance   nearesrdistance=distanceend loopits takes lots of time beacuse number of current points are so many per sec.tell me best way through distance formula.   