Re: Incremental Sort Cost Estimation Instability - Mailing list pgsql-hackers

From David Rowley
Subject Re: Incremental Sort Cost Estimation Instability
Date
Msg-id CAApHDvpKFyRJTZco4=Y9_seZC5J02+G-S9UHFoUz+Zz1oF_w7A@mail.gmail.com
Whole thread Raw
In response to Re: Incremental Sort Cost Estimation Instability  (Andrei Lepikhov <lepihov@gmail.com>)
Responses Re: Incremental Sort Cost Estimation Instability
Re: Incremental Sort Cost Estimation Instability
List pgsql-hackers
On Thu, 12 Sept 2024 at 21:51, Andrei Lepikhov <lepihov@gmail.com> wrote:
> Initial problem causes wrong cost_sort estimation. Right now I think
> about providing cost_sort() the sort clauses instead of (or in addition
> to) the pathkeys.

I'm not quite sure why the sort clauses matter any more than the
EquivalenceClass.  If the EquivalanceClass defines that all members
will have the same value for any given row, then, if we had to choose
any single member to drive the n_distinct estimate from, isn't the
most accurate distinct estimate from the member with the smallest
n_distinct estimate?  (That assumes the less distinct member has every
value the more distinct member has, which might not be true)

David



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Add has_large_object_privilege function
Next
From: David Rowley
Date:
Subject: Re: Docs: Order of json aggregate functions