Jing Fan wrote: > I have two group operations. > > One is inside the CTE ( union > select src_id, dest_id, min(dist) ), > another is outside the CTE. > Do you mean that even the grouping inside the CTE will be calculated only after the CTE has been > calculated? I mean the one outside the CTE. The one inside does not do anything at all, you could omit it. Yours, Laurenz Albe -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general