pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Etsuro Fujita <etsuro.fujita@gmail.com>
To: Corey Huinker <corey.huinker@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Nikolay Samokhvalov <nik@postgres.ai>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Cc: ashutosh.bapat.oss@gmail.com
Subject: Re: [PG19][PATCH] Make postgres_fdw statistics import atomic
Date: Wed, 23 Sep 2026 19:21:03 +0900
Message-ID: <CAPmGK14XTSDTxjNSv3FePWROyo6uNc-v2fCWCh3-R_-k95h5fQ@mail.gmail.com> (raw)
In-Reply-To: <CAPmGK15FgPgLVZmdqesk_F=zaxyaG9C4NR-10a_DfvCebNZNQA@mail.gmail.com>
References: <CAM527d-gHX4zZOhi9vvX+OsgEb+b2+fPbLUq8XRjAPYWQxDWjw@mail.gmail.com>
	<CADkLM=cAe4ezUexLu06o3t5b1btXbrDpOiCZkpnkxvV9OAVvWg@mail.gmail.com>
	<rjuaaeih3zniuoz5yoae7wwdobko5smqh5ytoudyish7udwtjz@rbtoai4kbc4r>
	<CADkLM=c_K4pp7-r_uQdzsb857GuR30eve5xpTGYCQ4A1csQAUg@mail.gmail.com>
	<CAPmGK15FgPgLVZmdqesk_F=zaxyaG9C4NR-10a_DfvCebNZNQA@mail.gmail.com>

On Sat, Sep 19, 2026 at 7:55 PM Etsuro Fujita <etsuro.fujita@gmail.com> wrote:
> > 2. Consider whether do_analyze_rel should do something (like clear the pg_statistic rows for the relation) in the case where numrows returned from the acquirefunc is zero.
>
> I also thought this option; it would make things logically clean, but
> I'm not sure we really need to do so, because in that case we set
> reltuples=0 in pg_class, which makes the planner effectively ignore
> the remaining attribute stats.  See set_baserel_size_estimates(); if
> reltuples=0, we have rel->tuples=0, so whatever value
> clauselist_selectivity() calculates/returns based on the attribute
> stats, rel->rows (the estimated number of output tuples from the base
> relation) is set to zero.

Correction: since clamp_row_est() forces a row-count estimate to be at
least one row, we have rel->rows=1, not rel->rows=0.  Sorry.

Best regards,
Etsuro Fujita





view thread (12+ messages)  latest in thread

Message-ID: <CAPmGK14XTSDTxjNSv3FePWROyo6uNc-v2fCWCh3-R_-k95h5fQ@mail.gmail.com>
Permalink:  ../CAPmGK14XTSDTxjNSv3FePWROyo6uNc-v2fCWCh3-R_-k95h5fQ@mail.gmail.com/
Also on:    postgresql.org/message-id/CAPmGK14XTSDTxjNSv3FePWROyo6uNc-v2fCWCh3-R_-k95h5fQ@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: etsuro.fujita@gmail.com, corey.huinker@gmail.com, andres@anarazel.de, nik@postgres.ai, pgsql-hackers@lists.postgresql.org, ashutosh.bapat.oss@gmail.com
  Subject: Re: [PG19][PATCH] Make postgres_fdw statistics import atomic
  In-Reply-To: <CAPmGK14XTSDTxjNSv3FePWROyo6uNc-v2fCWCh3-R_-k95h5fQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox