Michael Fuhr <[EMAIL PROTECTED]> writes: > Maybe one of the developers can comment on why your example calls > the function only once and mine calls it multiple times per row, > even though they look similar.
Look at the EXPLAIN results --- one case gets flattened into a single plan node and the other doesn't. I know exactly where that particular skeleton is buried, too: /* * Hack: don't try to pull up a subquery with an empty jointree. * query_planner() will correctly generate a Result plan for a * jointree that's totally empty, but I don't think the right things * happen if an empty FromExpr appears lower down in a jointree. Not * worth working hard on this, just to collapse SubqueryScan/Result * into Result... */ if (subquery->jointree->fromlist == NIL) return false; regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend