On Sun, Feb 15, 2015 at 2:08 PM, Alexander Korotkov <aekorotkov@gmail.com> wrote:
Following changes has been made in attached patch:
* Get sort operators from pathkeys.
* Recheck argument of distance function has been reverted.
Few comments were added and pairing heap comparison function was fixed in attached version of patch (knn-gist-recheck-6.patch). Also I expected that reordering in executor would be slower than reordering in GiST because of maintaining two heaps instead of one. I've revised version of patch with reordering in GiST to use pairing heap. I compare two types of reordering on 10^7 random points and polygons. Results are below. Test shows that overhead of reordering in executor is insignificant (less than statistical error).
Reorder in GiST Reorder in executor
points
limit=10 0.10615 0.0880125
limit=100 0.23666875 0.2292375
limit=1000 1.51486875 1.5208375
polygons
limit=10 0.11650625 0.1347
limit=100 0.46279375 0.45294375
limit=1000 3.5170125 3.54868125
Revised patch with reordering in GiST is attached (knn-gist-recheck-in-gist.patch) as well as testing script (test.py).