Manuel Sugawara <[EMAIL PROTECTED]> writes: > Ouch, 3117.48 msec vs. 1.15 msec is a huge difference. I need > something else? or may be postgres optimizer can't cope with > left/right joins?
I think the problem is you're constraining the join order into a very inefficient one. See http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/explicit-joins.html But it's difficult to be sure, when you are showing us EXPLAIN output that manifestly doesn't correspond to what you say the queries are. For instance the nearest match to "epr_vord_grupo AS grupo" in the explain output is "epr_ord_grupo g" ... I'm also wondering if any of the tables used in the queries are really views, and if so what the view definitions are. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org