Re: tableam: abstracting relation sizing code

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: tableam: abstracting relation sizing code
Date: 2019-06-10 19:46:48
Message-ID: 20190610194648.GA9230@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Jun-10, Robert Haas wrote:

> On Fri, Jun 7, 2019 at 6:42 PM Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:

> > The commit message still refers to it as estimate_rel_size though. The comment on
> > table_block_relation_estimate_size does too but that one might be intentional.
>
> Oops. New version attached, hopefully fixing those and the compiler
> warning Alvaro noted.

It does fix the warning, thanks.

> > Maybe I’m a bit thick but if the rel is totally empty and without children,
> > then curpages as well as relpages would be both zero. But if so, how can we
> > enter the second "quick exit” block since curpages by then will be increased to
> > 10 in the block just before for the empty case? It seems to me that the blocks
> > should be the other way around to really have a fast path, but I might be
> > missing something.
>
> Well, as you say, I'm just moving the code.

I agree that you're just moving the code, but this seems to have been
recently broken in 696d78469f37 -- it was correct before that (the
heuristic for never vacuumed rels was in optimizer/plancat.c). So in
reality the problem that Daniel pointed out is an open item for pg12.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Goel, Dhruv 2019-06-10 20:22:16 Re: Avoiding deadlock errors in CREATE INDEX CONCURRENTLY
Previous Message Robert Haas 2019-06-10 19:35:18 Re: tableam: abstracting relation sizing code