... btw, it occurs to me that at least as a stopgap,"set enable_nestloop = off" would be worth trying.The killer problem with rowcount-1 estimates is that theyencourage the planner to use nestloops when it shouldn't.
regards, tom lane