Re: Tid scan improvements

From: Edmund Horner <ejrh00(at)gmail(dot)com>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Tid scan improvements
Date: 2019-03-14 08:12:15
Message-ID: CAMyN-kC1Eacuk6LAMYH9-M9ddfn6JF1_kJZZedSH8gh7Ljckew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 14 Mar 2019 at 16:46, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> wrote:
>
> The only possible risk I can foresee is that it may be more likely we
> underestimate the selectivity and that causes something like a nested
> loop join due to the estimation being, say 1 row.
>
> It could happen in a case like:
>
> SELECT * FROM bloated_table WHERE ctid >= <last ctid that would exist
> without bloat>
>
> but I don't think we should keep using DEFAULT_INEQ_SEL just in case
> this happens. We could probably fix 90% of those cases by returning 2
> rows instead of 1.

Thanks for looking at the patch David.

I'm not sure how an unreasonable underestimation would occur here. If
you have a table bloated to say 10x its minimal size, the estimator
still assumes an even distribution of tuples (I don't think we can do
much better than that). So the selectivity of "ctid >= <last ctid
that would exist without bloat>" is still going to be 0.9.

Edmund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mitar 2019-03-14 08:13:51 Re: Feature: temporary materialized views
Previous Message Mitar 2019-03-14 08:05:59 Re: Re: Feature: triggers on materialized views