RE: wrong rows and cost estimation when generic plan

2022-12-05 Thread James Pang (chaolpan)
No create statistics on starttime_endtime(distinct), that index on "starttime,endtime", use default analyze, I tested to increase statistics_targets but that no help. Could you provide the function name for generic plan selectivity estimation? Thanks, James -Original Message- Fro

Re: wrong rows and cost estimation when generic plan

2022-12-05 Thread David Rowley
On Tue, 6 Dec 2022 at 18:28, James Pang (chaolpan) wrote: >-> Index Scan using idx_x_time on x (cost=0.44..8.48 rows=1 > width=2923) (actual time=8136.242..8136.242 rows=0 loops=1) > Index Cond: ((starttime = $7) AND (endtime = $8)) > Filter: ((password IS NULL) AN

RE: wrong rows and cost estimation when generic plan

2022-12-05 Thread James Pang (chaolpan)
Hi, It's a prepared sql statement on a non-partitioned table , 16millions tuples and multiple indexes on this table. pk_x primary key (aid,bid,btype) all 3 cols are bigint datatype, there is another index idx_x(starttime,endtime) , both cols are "timestamp(0) without time zone".

RE: wrong rows and cost estimation when generic plan

2022-12-05 Thread James Pang (chaolpan)
Hi, It's a prepared sql statement on a non-partitioned table , 16millions tuples and multiple indexes on this table. pk_x primary key (aid,bid,btype) all 3 cols are bigint datatype, there is another index idx_x(starttime,endtime) , both cols are "timestamp(0) without time zone".