> I put the EXPLAIN ANALYZE output at:
> http://developer.osdl.org/~jenny/large_explain_analyze
> http://developer.osdl.org/~jenny/small_explain_analyze
> The actual execution time is 37 seconds(large) vs 5 seconds (small).
>
There's an obvious row count misestimation in the 'large' plan:
-> Sort (cost=519.60..520.60 rows=400 width=31) (actual time=106.88..143.49 rows=30321 loops=1)
but I'm not good enough at reading these things to tell if that's the cause of the problem, or if so how to fix it :-(