Awesome, thanks that works and is quite clear. The plan looks a bit funny on this. Any high-level synopsis on the performance of this?
On Aug 15, 2012, at 16:24, David Greco <David_Greco@xxxxxxxxxxxxxxx> wrote:
With o (id, result) as (select id, getRecord(...) from dave)
Select id, (o.result).*
Left? Join o Using (id)
Regarding the INNER JOIN, actually it appears the opposite is true:
id, generate_series(1, dave.field1)
Works great if generate_series returns rows, but does not return any rows if generate_series does not return rows (i.e. if dave has a row with field1=null). So in fact, I need to figure out how to rewrite a LEFT JOIN version of this query
Agreed. See above example that can handle both.
On Aug 15, 2012, at 15:55, David Greco <David_Greco@xxxxxxxxxxxxxxx> wrote:
I suggest putting your function calls within a CTE (common table _expression_: SQL command WITH) structure.
I do not get why you think you need an "EXISTS" in the INNER JOIN situation. At worse you should make it a sub-query and add a IS NOT NULL condition on one of the function result columns. There is no way to avoid evaluating once per record in dave but you should never have to evaluate more frequently than that. CTE and sub-selects are your friends.
The original form is currently being developed but will not be available until at least 9.3
[Postgresql Jobs] [Postgresql Admin] [Postgresql Performance] [Linux Clusters] [PHP Home] [PHP on Windows] [Programming PHP] [Kernel Newbies] [PHP Classes] [Find Someone Nice] [PHP Books] [PHP Databases] [Postgresql & PHP] [Yosemite]