Hi everyone!
Thank you for your work.
1) While exploring extended statistics, I encountered a bug that occurs
when using EXPLAIN (STATS) with queries containing OR conditions:
CREATE TABLE t (a int, b int, c int, d int);
INSERT INTO t SELECT x/10+1, x, x + 10, x * 2 FROM
generate_series(1,10000) g(x);
CREATE STATISTICS ON a, b FROM t;
CREATE STATISTICS ON c, d FROM t;
ANALYZE;
The following query works as expected:
EXPLAIN (STATS) SELECT * FROM t WHERE a > 0 AND b > 0 AND c > 0 AND d > 0;
QUERY PLAN
----------------------------------------------------------------
Seq Scan on t (cost=0.00..255.00 rows=10000 width=16)
Filter: ((a > 0) AND (b > 0) AND (c > 0) AND (d > 0))
Ext Stats: public.t_a_b_stat Clauses: ((a > 0) AND (b > 0))
Ext Stats: public.t_c_d_stat Clauses: ((c > 0) AND (d > 0))
(4 rows)
However, when using OR conditions, the following query results in an error:
EXPLAIN (ANALYZE, STATS) SELECT * FROM t WHERE a > 0 AND b > 0 OR c > 0
AND d > 0;
ERROR: unrecognized node type: 314
2) It would be great if the STATS flag appeared as an option when
pressing Tab during query input in the psql command-line interface.
Best regards,
Ilia Evdokimov,
Tantor Labs LLC.