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