Matthew Churcher <matthew(dot)churcher(at)realvnc(dot)com> writes:
> I've tried cursor_tuple_fraction values as low as 0.0000000001 which by my reckoning should be low enough and also 0 but the planner is still selecting seqscan-and-sort.
Hm. Keep in mind that plpgsql caches query plans, so if you're
examining this by checking the runtime of the function you showed,
you'd need to start a fresh session, set cursor_tuple_fraction, then
try the function to be sure you were seeing the effects of the
parameter change.
regards, tom lane