Re: Our trial to TPC-DS but optimizer made unreasonable plan - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Our trial to TPC-DS but optimizer made unreasonable plan
Date
Msg-id 23177.1440635307@sss.pgh.pa.us
Whole thread Raw
In response to Re: Our trial to TPC-DS but optimizer made unreasonable plan  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Our trial to TPC-DS but optimizer made unreasonable plan  (Qingqing Zhou <zhouqq.postgres@gmail.com>)
List pgsql-hackers
I wrote:
> What I had in mind in <38448.1430519406@sss.pgh.pa.us> was to convert CTEs
> into plain subqueries during the prepjointree phase, either just before
> or as part of the pull_up_subqueries pass (since you'd want the converted
> subquery to be flattened if possible).

After looking at the code a bit, IMO the most reasonable thing to do is to
include this transformation in inline_set_returning_functions(), perhaps
renaming it to something like inline_srfs_and_ctes().  You could invent
a separate function instead, but that would require an extra pass over
the rangetable, for no particular benefit that I can see; the separate
function would have to be called from *exactly* the same set of places
as inline_set_returning_functions(), anyway, or it would not work right
for multiple levels of query optimization.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Our trial to TPC-DS but optimizer made unreasonable plan
Next
From: Noah Misch
Date:
Subject: Re: 9.4 broken on alpha