Emil,
> -> Merge Left Join (cost=9707.71..13993.52 rows=1276 width=161)
> (actual time=164.423..361.477 rows=49 loops=1)
That would indicate that you need to either increase your statistical
sampling (SET STATISTICS) or your frequency of running ANALYZE, or both.
--
--Josh
Josh Berkus
Aglio Database Solutions
San Francisco