Re: Import Statistics in postgres_fdw before resorting to sampling.

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)postgresql(dot)org, jkatz(at)postgresql(dot)org, nathandbossart(at)gmail(dot)com
Subject: Re: Import Statistics in postgres_fdw before resorting to sampling.
Date: 2026-01-23 17:15:40
Message-ID: CADkLM=f5e+MvnDG_swTiJ=2ha02ksMY7njK7xuK=ktX3-mxUkQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> >> There's an advantage if we can combine stats across multiple relations
> >> - we don't have to sample children twice when analyzing the parent
> >> without ONLY. Instead we could produce parent statistics by combining
> >> statistics across children and the parent. To me this looks like
> >> altogether a different beast just like partial aggregates.
> >
> >
> > I think this patch is only ever going to get us out of 1 of the 2
> samples, which isn't ideal but it is a savings.
> >
>
> I am not suggesting to synthesize sample rows. Calculate the
> statistics of the parent table from that of its children.
>

I'm not sure we can actually do that. The functions that compute the
statistics are all based off of row samples, not already computed
statistics. I don't think we can synthesize a rowsample from the imported
statistics, at least not accurately. If I'm misunderstanding what you're
suggesting, please correct me.

> The note just mentions partition table but the limitation applies to
> any foreign child table.
>

Noted. Will fix in next revision.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-01-23 17:19:11 Re: Time to add FIDO2 support?
Previous Message Nathan Bossart 2026-01-23 16:49:16 Re: Fix rounding method used to compute huge pages