"Nicholay P. Chuprynin" <kolyan@infoport.uz> writes:
> I switched enable_seqscan to 'false', restarted server and EXPLAINed the
> same query again:
> ...
> Now it uses index scan, but query takes MUCH more time than before (about
> an hour, and it's not finished yet).
> It seems very strange for me.
Indexscan over a large fraction of a table is not a win compared to
a sequential scan. Random access is just too expensive.
> Can someone explain what's wrong here?
Nothing. The planner knew what it was doing to prefer the seqscan.
regards, tom lane