"Niclas Gustafsson" <niclas(dot)gustafsson(at)codesense(dot)com> writes:
> Can someone please explain why the first query is 3000 times slower?
> Surely there must be a any way to speed it up?
You're forcing a poor join order. See
http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/explicit-joins.html
regards, tom lane