Re: Expr. extended stats are skipped with equality operator

2022-08-05 Thread Tom Lane
Justin Pryzby writes: > A reproducer for this: > CREATE TABLE t1(x int[], y float); > INSERT INTO t1 SELECT array[1], a FROM generate_series(1,99)a; > CREATE STATISTICS s2 ON (CASE x[1] WHEN 1 THEN true ELSE false END), y FROM > t1; > ANALYZE t1; > explain analyze SELECT * FROM t1 WHERE CASE x

Re: Expr. extended stats are skipped with equality operator

2022-08-05 Thread Justin Pryzby
On Fri, Aug 05, 2022 at 04:43:36PM +0300, Danny Shemesh wrote: > 2. Less important, just a minor note - feel free to ignore - although the > eq. operator above seems to be skipped when matching the ext. stats, I can > work around this by using a CASE expression (fiddle >

Expr. extended stats are skipped with equality operator

2022-08-05 Thread Danny Shemesh
Hey all ! I'm on a quest to help the planner (on pg14) use the best of several partial, expressional indices we have on some large tables (few TBs in size, billions of records). As we know, stats for expressions in partial indices aren't gathered by default - so I'm tinkering with expressional ex