Re: Incremental Sort Cost Estimation Instability

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Andrei Lepikhov <lepihov(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Subject: Re: Incremental Sort Cost Estimation Instability
Date: 2024-09-12 10:12:03
Message-ID: CAApHDvpKFyRJTZco4=Y9_seZC5J02+G-S9UHFoUz+Zz1oF_w7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 12 Sept 2024 at 21:51, Andrei Lepikhov <lepihov(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2024-09-12 10:13:00 Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row
Previous Message Fujii Masao 2024-09-12 10:07:22 Re: Add has_large_object_privilege function