On 1/9/19 4:43 PM, Surafel Temesgen wrote:
>
>
> On Wed, Jan 9, 2019 at 5:38 PM Tomas Vondra
> <tomas.vondra@2ndquadrant.com <mailto:tomas.vondra@2ndquadrant.com>> wrote:
>
>
> It's hard to say what exactly are you doing, because you haven't shared
> any code nor examples.
>
>
> okay i attach in progress patch
>
Yeah, that's what I thought - the patch computes
node->count = DatumGetInt64(100 / DatumGetFloat8(val));
and then always fetches this number of records before emitting the next
row from the tuplestore. That's wrong, as I explained before, because
the distance does change, due to rounding.
See the attached patch, which recomputes the count regularly. I don't
claim the patch is committable or that it has no other bugs, but
hopefully it shows what I meant.
FWIW you don't need to create any slots - the two already created are
enough. You certainly don't need to create the slots within a loop.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services