postgres.git / summary / log / commit / refs

commit    d17b6df239e6eebf288969e931cdbe8076d1fe12
Author:   Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date:     Tue Feb 17 20:33:38 2015 +0000
First released in: 9.5.0

    Fix knn-GiST queue comparison function to return heap tuples first.
    
    The part of the comparison function that was supposed to keep heap tuples
    ahead of index items was backwards. It would not lead to incorrect results,
    but it is more efficient to return heap tuples first, before scanning more
    index pages, when both have the same distance.
    
    Alexander Korotkov


src/backend/access/gist/gistscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c index cc8d818e11d..991858ff43f 100644 --- a/src/backend/access/gist/gistscan.c +++ b/src/backend/access/gist/gistscan.c @@ -41,9 +41,9 @@ pairingheap_GISTSearchItem_cmp(const pairingheap_node *a, const pairingheap_node /* Heap items go before inner pages, to ensure a depth-first search */ if (GISTSearchItemIsHeap(*sa) && !GISTSearchItemIsHeap(*sb)) - return -1; - if (!GISTSearchItemIsHeap(*sa) && GISTSearchItemIsHeap(*sb)) return 1; + if (!GISTSearchItemIsHeap(*sa) && GISTSearchItemIsHeap(*sb)) + return -1; return 0; } [parent: 2e105def09f2]