Forum OpenACS Q&A: Response to Weird PostgreSQL SELECT processing

Posted by Don Baccus on
select p.placement_id
from placements p, (select placement_id,count(*)
                    from placement_log log
                    where placement_id=177 group by placement_id) l where placement_id=p.placement_id and
It looks like it is calling the function before doing the join, which in general isn't a terribly bad idea though it can be in certain cases. Actually it's probably doing the qualification while doing the join which results in the same thing (calling the function for every row in placements) but I'd have to dig around inside PG to be sure.

If it makes you feel better Oracle frequently does the same thing.