Re[2]: Index-only scan not working when IN clause has 2 or more values

2022-11-28 Thread Anna B .
Hi Tom and community,   Thank you very much!  After digging how Postgres planner uses statistics, I have increased table statistics from 100 to 1000. It was enough for planner to use multiple scans of the index and then sort! (Also I have added dependency extended stats on the three columns as y

Re: Index-only scan not working when IN clause has 2 or more values

2022-11-25 Thread Tom Lane
=?UTF-8?B?QW5uYSBCLg==?= writes: > create index "ix-transaction-client-trans_dttm-division" > on transaction (client_id, > trans_dttm desc, > division_code); > > EXPLAIN (ANALYZE, BUFFERS) > select * > from transaction > where client_id = 123456 > an

Index-only scan not working when IN clause has 2 or more values

2022-11-24 Thread Anna B .
  Hi all,   CREATE TABLE transaction (     client_id     decimal(18, 0) NOT NULL,     trans_dttm    timestamp,     division_code varchar(255),     ... )   One row size = approx 2Kb.   Usually table is searched by client_id and trans_dttm, but sometimes also by division_code, so:   create index "i