I have a query that is taking too long when run from a larger plpgsql function (40-50s). However when I explain analyze it under psql it runs fine (4-5s). This is with the same parameters, and I've even tried embedding the parameters inside a subquery to avoid letting the planner see any more info than normal.
Is there any way to ask the server what plan it's using when it's actually executing the query in production, rather than trying to feed it the same query later in another context and hope it gets the same result? -- greg ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html