I'm trying to work out how the planner arrived at the numbers you're
showing; the hashjoin cost estimate seems a little lower than I'd
expect. Are you using nonstandard values for any of the planner cost
factors? (cpu_operator_cost, etc) How about sort_mem?
regards, tom lane