Re: star schema and the optimizer - Mailing list pgsql-hackers

From Tom Lane
Subject Re: star schema and the optimizer
Date
Msg-id 31969.1425053952@sss.pgh.pa.us
Whole thread Raw
In response to Re: star schema and the optimizer  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: star schema and the optimizer  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I wrote:
> I had actually thought that we'd fixed this type of problem in recent
> versions, and that you should be able to get a plan that would look like

>     Nestloop
>       -> scan dim1
>       -> Nestloop
>            -> scan dim2
>            -> indexscan fact table using dim1.a and dim2.b

> which would arise from developing an indexscan on fact that's
> parameterized by both other tables, resolving one of those
> parameterizations via a join to dim2, and then the other one
> via a join to dim1.  I'm not sure offhand why that isn't working
> in this example.

It looks like the issue is that the computation of param_source_rels
in add_paths_to_joinrel() is overly restrictive: it thinks there is
no reason to generate a parameterized-by-dim2 path for the join
relation {fact, dim1}, or likewise a parameterized-by-dim1 path for
the join relation {fact, dim2}.  So what we need is to understand
when it's appropriate to do that.  Maybe the mere existence of a
multiply-parameterized path among fact's paths is sufficient.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: star schema and the optimizer
Next
From: Tomas Vondra
Date:
Subject: Re: Providing catalog view to pg_hba.conf file - Patch submission