Re: Statistics Import and Export

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(at)paquier(dot)xyz>, jian he <jian(dot)universality(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, alvherre(at)alvh(dot)no-ip(dot)org
Subject: Re: Statistics Import and Export
Date: 2025-02-24 06:39:01
Message-ID: b227c4fca29dfb893bb414ce6d84fc2377489ecc.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 2025-02-23 at 20:03 -0500, Corey Huinker wrote:
> If we're fine with giving up on appendNamedArgument() for relstats,
> wouldn't we also want to mash these into a single call?

...

> appendPQExpBuffer(out, "\t'relation', '%s'::regclass"
>                        ",\n\t'version', '%u'::integer"
>                        ",\n\t'relpages', '%d'::integer"
>                        ",\n\t'reltuples', '%s'::real"
>                        ",\n\t'relallvisible', '%d'::integer",
>                        qualname, fout->remoteVersion, rsinfo-
> >relpages,
>                        rsinfo->reltuples_str, rsinfo->relallvisible);
> appendPQExpBufferStr(out, "\n);\n");

+1.

>
>
> Part of me thinks we'd want to do the reverse - change the struct to
> store char[32] to for each of relpages, reltuples, and relallvisible,
> and then convert reltpages to int in the one place where we actually
> need to use in its numeric form, and even then only in one place.
> Conversions to and from other data types introduce the possibility,
> though very remote, of the converted-and-then-unconverted value being
> cosmetically different from what we got from the server, and if down
> the road we're dealing with more complex data types, those
> conversions might become significant.

That's a good point but let's avoid excessive redundancy in the
structures. Adding a few fields to RelStatsInfo should be enough.

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2025-02-24 06:50:19 Re: Virtual generated columns
Previous Message Pavel Stehule 2025-02-24 06:22:15 Re: psql \dh: List High-Level (Root) Tables and Indexes