Re: examine_variable ignored CollateExpr

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: ZizhuanLiu X-MAN <44973863(at)qq(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, jian he <jian(dot)universality(at)gmail(dot)com>, tgl <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Guo <rguo(at)postgresql(dot)org>
Subject: Re: examine_variable ignored CollateExpr
Date: 2026-10-05 03:59:37
Message-ID: CAGRkXqTZjRj2x0vKFbT6pM0+-_1kvKbmSPA9HwCX_wB-BkmynA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Jian,

With v1 or v4 I get a worse estimate when the table has no
statistics object.

CREATE TABLE t (a text);
INSERT INTO t SELECT chr(65 + g % 52)
FROM generate_series(1, 5200) g;
ANALYZE t;
EXPLAIN SELECT * FROM t WHERE a COLLATE "C" = 'A';

On master I get
Seq Scan on t (cost=0.00..89.00 rows=100 width=2)
With v1 or v4 I get
Seq Scan on t (cost=0.00..89.00 rows=26 width=2)

Could we keep the stripping, and check the statistics expressions
first only when a COLLATE was stripped from a plain column? A
table without extended statistics pays one test of rel->statlist.

Thanks,
Shihao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-10-05 04:03:07 pg_resetwal: add --cluster-state option
Previous Message Fujii Masao 2026-10-05 03:51:44 Re: REPACK (CONCURRENTLY) might keep dropped-column data