Re: pg_statistic MCVs use float4 but extended stats use float8

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg_statistic MCVs use float4 but extended stats use float8
Date: 2023-02-15 13:22:07
Message-ID: 14390227-9931-585e-57e2-6e1d1d568382@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2/15/23 02:20, Justin Pryzby wrote:
> It seems odd that stats_ext uses double:
>
> postgres=# SELECT attrelid::regclass, attname, atttypid::regtype, relkind FROM pg_attribute a JOIN pg_class c ON c.oid=a.attrelid WHERE attname='most_common_freqs';
> attrelid | attname | atttypid | relkind
> --------------------+-------------------+--------------------+---------
> pg_stats | most_common_freqs | real[] | v
> pg_stats_ext | most_common_freqs | double precision[] | v
> pg_stats_ext_exprs | most_common_freqs | real[] | v
>
> I'm not sure if that's deliberate ?
>

Not really, I'm not sure why I chose float8 and not float4. Likely a
cause of muscle memory on 64-bit systems.

I wonder if there are practical reasons to change this, i.e. if the
float8 can have adverse effects on some systems. Yes, it makes the stats
a little bit larger, but I doubt the difference is significant enough to
make a difference. Perhaps on 32-bit systems it's worse, because float8
is going to be pass-by-ref there ...

regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2023-02-15 13:48:46 Re: Use of additional index columns in rows filtering
Previous Message Andrew Dunstan 2023-02-15 12:53:15 Re: Can we do something to help stop users mistakenly using force_parallel_mode?