Thomas Guettler wrote:
> My naive first solution was quite slow. Why is it so slow?
> I guess (select d.master_id from detail as d) gets executed for every
> master-row. But why? Shouldn't
> it be possible to calculate it once and then reuse it?
Please show exact schema dumps and your PostgreSQL version.