| From: | Chengpeng Yan <chengpeng_yan(at)outlook(dot)com> |
|---|---|
| To: | Alexandra Wang <alexandra(dot)wang(dot)oss(at)gmail(dot)com> |
| Cc: | Tomas Vondra <tomas(at)vondra(dot)me>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Is there value in having optimizer stats for joins/foreignkeys? |
| Date: | 2026-08-09 12:50:09 |
| Message-ID: | BE2AB1CA-8187-4A68-8E00-0DFD55D39B7E@outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
> On Aug 4, 2026, at 07:06, Alexandra Wang <alexandra(dot)wang(dot)oss(at)gmail(dot)com> wrote:
>
> For this round I'd most appreciate a thorough review of 0001 and 0002
> to see whether they're committable.
I reviewed 0001 and 0002.
0001 looks good to me as well.
For 0002, in addition to Tomas's comments, I noticed an issue with an
expression that const-folds to a plain column:
```
CREATE TABLE t (a int);
INSERT INTO t SELECT g FROM generate_series(1, 100) g;
CREATE STATISTICS s
ON (CASE WHEN true THEN a END)
FROM t;
ANALYZE t;
```
On v9, the object has `stxkind = {e}`, but `stxdexpr` is NULL and
`pg_stats_ext_exprs` has no row for it. Before 0002, the same definition
produced expression statistics.
Since v9 treats an expression that const-folds to a plain column as that
column, I think this single-entry definition should be rejected, just
like a statistics object defined on a single plain column. Instead, it
is accepted with `stxkind = {e}`, but `ANALYZE` builds no expression
statistics, which seems inconsistent.
--
Best regards,
Chengpeng Yan
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tomas Vondra | 2026-08-09 13:34:07 | Re: WAL compression setting after PostgreSQL LZ4 default change |
| Previous Message | Tatsuya Kawata | 2026-08-09 11:22:35 | [PATCH] Remove stale comment and dead store in BuildTupleHashTable |