I got a good suggestion from Hiroshi. The conclusion is:
> pid int2, -- has an btree index
This is bad. I had defined a btree index on pid and it has 2000
duplicate entries in average! After I removed the index, the query
runs unbelievably fast! Now explain shows:
Nested Loop (cost=933.82 size=1 width=100) -> Index Scan using cityindex on postal (cost=931.77 size=1 width=74) ->
IndexScan using prefpidindex on prefecture (cost=2.05 size=47 width=26)
--
Tatsuo Ishii