This is just an example isolating the problem. Actual queries contain more tables and more joins and return reasonable amount of data. Performance of big indices however is appalling, with planner always reverting to seqscan with default settings. I tried to pre-filter the data as much as possible in preceding joins to put less strain on the offending join (less rows to join by?) but it doesn't help. I wonder what exactly makes index perform 100+ times slower than seqscan - I mean even if it's perfromed on the HD which it should not be given the index size, index and table are on the same HD and index is smaller and also sorted, isn't it?