Re: [PG19][PATCH] Make postgres_fdw statistics import atomic - Mailing list pgsql-hackers

From Etsuro Fujita
Subject Re: [PG19][PATCH] Make postgres_fdw statistics import atomic
Date
Msg-id CAPmGK14XTSDTxjNSv3FePWROyo6uNc-v2fCWCh3-R_-k95h5fQ@mail.gmail.com
Whole thread
In response to Re: [PG19][PATCH] Make postgres_fdw statistics import atomic  (Etsuro Fujita <etsuro.fujita@gmail.com>)
List pgsql-hackers
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
casewhere 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



pgsql-hackers by date:

Previous
From: Nazir Bilal Yavuz
Date:
Subject: Re: Stabilize and shorten test_checksums/013_rewind test
Next
From: Etsuro Fujita
Date:
Subject: Re: [PG19][PATCH] Make postgres_fdw statistics import atomic