> > This seems to be the source of the misestimation. You might > > want to try using "n WHERE n.nodein NOT IN (SELECT nodeid > > FROM templates)" instead of "n LEFT JOIN templates USING > > (nodeid) WHERE templates.nodeid IS NULL" and see if it helps. > > it helped, the new version of the query takes 2303 ms on both > 8.1.4 and 8.2.4.
this is very interesting. on 8.1.x i have also repeatedly had to rewrite joins as their equivalent IN/NOT IN alternatives in order to improve performance, so i feel that at least under some alignments of the planets 8.1 has similar problems. george ---------------------------(end of broadcast)--------------------------- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate