On Tue, Oct 3, 2017 at 8:16 AM, Amit Khandekar <amitdkhan...@gmail.com> wrote: > While writing this down, I observed that after multi-level partition > tree expansion was introduced, the child table expressions are not > converted directly from the root. Instead, they are converted from > their immediate parent. So there is a chain of conversions : to leaf > from its parent, to that parent from its parent, and so on from the > root. Effectively, during the first conversion, there are that many > ConvertRowtypeExpr nodes one above the other already present in the > UPDATE result rel expressions. But my patch handles the optimization > only for the leaf partition conversions. > > If already has CRE : CRE(rr) -> wr(r) > Parent-to-child conversion ::: CRE(p) -> wr(r) ===> CRE(rr) -> > CRE(r) -> wr(c1) > W patch : CRE(rr) -> CRE(r) -> wr(c1) ===> CRE(rr) -> CRE(r) -> wr(c2)
Maybe adjust_appendrel_attrs() should have a similar provision for avoiding extra ConvertRowTypeExpr nodes? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers