Using auto_explain may be needed to catch the plan when it is slow, if theother suggestions don't resolve things for you.