Re: FETCH FIRST clause WITH TIES option

Surafel Temsgen <surafel3000@gmail.com>

From: Surafel Temesgen <surafel3000@gmail.com>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>, andrew@tao11.riddles.org.uk, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2019-01-16T08:45:46Z
Lists: pgsql-hackers

Attachments

On Tue, Jan 15, 2019 at 2:51 PM Tomas Vondra <tomas.vondra@2ndquadrant.com>
wrote:


> What do you mean by "raw statistic"?
>

I mean without further calculation to consider other operation


>
> IMHO the best thing you can do is call estimate_num_groups() and combine
> that with the number of input rows. That shall benefit from ndistinct
> coefficients when available, etc. I've been thinking that considering
> the unreliability of grouping estimates we should use a multiple of the
> average size (because there may be much larger groups), but I think
> that's quite unprecipled and I'd much rather try without it first.
>
>
thank you for clarifying.

The attache patch use your suggestion uptread

regards

Surafel

Commits

  1. Support FETCH FIRST WITH TIES