CREATE FUNCTION CREATE FUNCTION CREATE TABLE INSERT 0 100000 QUERY PLAN --------------------------------------------------------------------------------------------------- Seq Scan on t (cost=0.00..1944.77 rows=3 width=8) (actual time=0.049..37.182 rows=10000 loops=1) Filter: ((a = 1) AND (b = 1)) Rows Removed by Filter: 90000 Planning Time: 0.380 ms Execution Time: 37.751 ms (5 rows) clause | extstats --------+---------- (0 rows) QUERY PLAN --------------------------------------------------------------- HashAggregate (cost=1944.77..2044.89 rows=10012 width=12) Group Key: a, b -> Seq Scan on t (cost=0.00..1444.18 rows=100118 width=8) (3 rows) clause | extstats --------+---------- (0 rows) CREATE STATISTICS ANALYZE List of extended statistics Schema | Name | Definition | Ndistinct | Dependencies | MCV --------+------+-------------+-----------+--------------+--------- public | s | a, b FROM t | defined | defined | defined (1 row) QUERY PLAN ------------------------------------------------------------------------------------------------------ Seq Scan on t (cost=0.00..1943.00 rows=9947 width=8) (actual time=0.021..26.203 rows=10000 loops=1) Filter: ((a = 1) AND (b = 1)) Rows Removed by Filter: 90000 Ext Stats: public.s Clauses: ((a = 1) AND (b = 1)) Planning Time: 0.169 ms Execution Time: 26.958 ms (6 rows) clause | extstats -------------------------------+------------------------------------------ Filter: ((a = 1) AND (b = 1)) | public.s Clauses: ((a = 1) AND (b = 1)) (1 row) QUERY PLAN --------------------------------------------------------------------------------------------------------------- HashAggregate (cost=1943.00..1943.10 rows=10 width=12) (actual time=96.912..96.918 rows=10 loops=1) Group Key: a, b Batches: 1 Memory Usage: 24kB -> Seq Scan on t (cost=0.00..1443.00 rows=100000 width=8) (actual time=0.026..24.280 rows=100000 loops=1) Ext Stats: public.s Clauses: a, b Planning Time: 0.353 ms Execution Time: 96.974 ms (7 rows) clause | extstats -----------------+------------------------- Group Key: a, b | public.s Clauses: a, b (1 row) SET QUERY PLAN --------------------------------------------------------------------------------------------------------------- HashAggregate (cost=1943.00..1943.10 rows=10 width=12) (actual time=89.360..89.366 rows=10 loops=1) Group Key: a, b Batches: 1 Memory Usage: 24kB -> Seq Scan on t (cost=0.00..1443.00 rows=100000 width=8) (actual time=0.017..19.903 rows=100000 loops=1) Ext Stats: public.s Clauses: a, b Ext Stats: public.s Clauses: a, b Planning Time: 0.094 ms Execution Time: 89.409 ms (8 rows) clause | extstats -----------------+------------------------- Group Key: a, b | public.s Clauses: a, b (1 row) PREPARE QUERY PLAN ------------------------------------------------------------------------------------------------------ Seq Scan on t (cost=0.00..1943.00 rows=9850 width=8) (actual time=0.024..27.818 rows=10000 loops=1) Filter: ((a = 5) AND (b = 5)) Rows Removed by Filter: 90000 Planning Time: 0.108 ms Execution Time: 28.510 ms (5 rows) DROP TABLE DROP FUNCTION List of extended statistics Schema | Name | Definition | Ndistinct | Dependencies | MCV --------+------+------------+-----------+--------------+----- (0 rows)