Re: final patch - plpgsql: for-in-array
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>, Andrew Dunstan <andrew@dunslane.net>, Merlin Moncure <mmoncure@gmail.com>, Jaime Casanova <jaime@2ndquadrant.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2010-11-18T19:46:28Z
Lists: pgsql-hackers
2010/11/18 Tom Lane <tgl@sss.pgh.pa.us>: > Pavel Stehule <pavel.stehule@gmail.com> writes: >> "unnest" returns all fields, but >> these fields should not be used. There isn't possible to say - stop, I >> don't need other fields. It's possible just with special PL statement, >> because it is controlled by PL. So it is reason why I don't believe in >> optimizations on PL level. > > That is complete nonsense. array_unnest doesn't return the whole array > contents at once, so it's just as capable of being optimized as any > single-purpose implementation. If you exit the loop early, you just > don't call it anymore. no it isn't - actually you cannot to limit a returned set when you call SRF function in expression context - if I remember well. We can change it - but this is other complexity. Pavel > > regards, tom lane >