On Thu, 2007-01-18 at 11:53 +1100, Gavin Sherry wrote: > the major rule in the executor: do what ever the plan tells you to do.
I thought the rule was: do what the plan tells you to do, as efficiently as possible. Turning an explicit step into a no-op seems like great execution to me. In the case you mention, the HashJoin node already looks inside its Hash node child. It seems possible to have the Sort node check at ExecInit time that it is sitting on a HashJoin node, so that at Exec time it can ask the HashJoin node whether the Hash node has spilled to disk or not. If not, it can just pass the rows through as a no-op. We could formalise a "last words" API so that parent nodes sometimes calls child nodes before they execute them, or maybe just leave it somewhat dirty as the H/HJ communication is now. -- Simon Riggs EnterpriseDB http://www.enterprisedb.com ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq