Re: Top-N sorts in EXPLAIN, row count estimates, and parallelism

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Top-N sorts in EXPLAIN, row count estimates, and parallelism
Date: 2019-05-23 22:36:54
Message-ID: 20190523223654.tpkigtzavpjxluj4@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2019-05-23 18:31:43 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > It's also noticable that we preposterously assume that the sort actually
> > will return exactly the number of rows in the table, despite being a
> > top-n style sort.
>
> In general, we report nodes below LIMIT with their execute-to-completion
> cost and rowcount estimates. Doing differently for a top-N sort would
> be quite confusing, I should think.

I'm not quite sure that's true. I mean, a top-N sort wouldn't actually
necessarily return all the input rows, even if run to completion. Isn't
that a somewhat fundamental difference?

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2019-05-23 22:43:27 Re: Question about BarrierAttach spinlock
Previous Message Mark Dilger 2019-05-23 22:36:38 Re: ClosePipeStream failure ignored in pg_import_system_collations