Tom Lane wrote: > Well, here's our problem it would seem: the planner is estimating the IN > clause to match 317227 rows, rather than the actual 2522. That's > naturally going to bias it against choosing an indexscan. You need to > get that estimate closer before there's going to be much chance of > choosing the right plan. > >> What do you mean with larger statistics target? > > See ALTER TABLE SET STATISTICS, or just change default_statistics_target > and re-ANALYZE. Thanks, that definitly looks like a starting point. I will test it and post my results. Btw. what happens if the estimation would be to low?