Re: Any way to get nested loop index joins on CTEs?

From: Jean-Christophe BOGGIO <postgresql(at)thefreecat(dot)org>
To: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Any way to get nested loop index joins on CTEs?
Date: 2025-07-16 11:24:54
Message-ID: e2dd3659-50e4-4727-a11c-f23b8d5c254d@thefreecat.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Following up on this, I very often have to create PLPgSql functions to
workaround this problem: create one (or several) temp table(s) (with ON
COMMIT DROP), analyze it/them and create indices on some field(s).

Being able to write something like:

WITH xxx AS MATERIALIZED ANALYZED INDEXED ON field1 (
    SELECT DISTINCT myfield AS field1
    FROM table1
)
SELECT field2
FROM table2
JOIN xxx USING(field1);

would help a lot in some cases. Of course, the syntax is just a thought
but the general idea is there.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jerry Brenner 2025-07-18 01:09:50 Is there a way to identify a plan generated by GECO?
Previous Message Clemens Eisserer 2025-07-15 13:29:27 Any way to get nested loop index joins on CTEs?