Have you tried putting those components in a common table expression?
I'm not sure if it absolutely forces the materialization or not, but in
practice that has been my experience.
Robert James wrote:
> I have a query which, when I materialize by hand some of its
> components, runs 10x faster (including the time needed to
> materialize). Is there any way to force Postgres to do that? Or do I
> need to do this by hand using temp tables?
>
>