Re: FETCH FIRST clause WITH TIES option

From: Surafel Temesgen <surafel3000(at)gmail(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, andrew(at)tao11(dot)riddles(dot)org(dot)uk, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: FETCH FIRST clause WITH TIES option
Date: 2019-01-16 08:45:46
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

On Tue, Jan 15, 2019 at 2:51 PM Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>

> 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



Attachment Content-Type Size
fetch_first_with_ties_v5.patch text/x-patch 28.4 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2019-01-16 09:09:56 Re: Log a sample of transactions
Previous Message Adrien NAYRAT 2019-01-16 08:34:33 Re: Log a sample of transactions