[postgis-devel] Predict returned geom in KNN with equal distance

Sandro Santilli strk at kbt.io
Fri Aug 13 03:35:57 PDT 2021


Is there a way to predict which geometry is returned from an KNN
query (ORDER BY geom <-> $1 LIMIT 1) in case of equidistance ?

I think for sequencial scan the order is determined by
the order data entered the db or was updated (which
I can control via clustering).

But how are geometries scanned in case of GiST index scan ?
Would CLUSTER ON the_gist_index affect that return ?
Would REINDEX INDEX the_gist_index affect that return ?

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   https://strk.kbt.io/services.html


More information about the postgis-devel mailing list