Bruce Momjian wrote:

> >           ->  Index Scan using gindex on btable  (cost=2.05 rows=1 width=4)
> >   ->  Hash  (cost=399.00 rows=10000 width=4)
> >         ->  Seq Scan on btable  (cost=399.00 rows=10000 width=4)
> > -------------
> 
> You can't use in index here because an IN is not selective, or if it is,
> there is way for the optimizer to know this.

Ok. It seems that statistics which is within optimizer's reach is quite
poor, so optimizer can't always make sane predictions. And, I am
afraid, improving statistics gathering will require major rewrite of code.

So there should at least be some way to give hints to optimizer,
shouldn't it?

-- 
Leon.

Reply via email to