http://www.perlmonks.org?node_id=953579


in reply to same query, different execution, different performance

I recommend turning on full logging in PostgreSQL to see if there is a difference in the actual SQL being passed to the server and then run EXPLAIN on the statements if they are different.

Celebrate Intellectual Diversity