Re: Query-plan for partitioned UPDATE/DELETE slow and swaps vmem compared to SELECT - Mailing list pgsql-performance

From Tom Lane
Subject Re: Query-plan for partitioned UPDATE/DELETE slow and swaps vmem compared to SELECT
Date
Msg-id 28785.1291658624@sss.pgh.pa.us
Whole thread Raw
In response to Re: Query-plan for partitioned UPDATE/DELETE slow and swaps vmem compared to SELECT  (John Papandriopoulos <dr.jpap@gmail.com>)
Responses Re: Query-plan for partitioned UPDATE/DELETE slow and swaps vmem compared to SELECT
List pgsql-performance
John Papandriopoulos <dr.jpap@gmail.com> writes:
> The memory issue has indeed disappeared---there was no noticeable memory increase in the three queries below, with
4096children.  Inheritance planning overhead is around 20x for UPDATE/DELETE compared to SELECT; thankfully they are
requiredmuch less frequently in my case. 

> I am still wondering whether the inheritance_planner(...) can be avoided if the rowtypes of children are the same as
theparent? 

Possibly, but it's far from a trivial change.  The difficulty is that
you'd need to generate a different plan tree structure.
inheritance_planner generates a separate subtree for each target table,
so that the ModifyTable node can execute each one separately and know
a priori which target table the rows coming out of a particular subplan
apply to.  If we expand inheritance "at the bottom" like SELECT does,
that table identifier would have to propagate up as part of the returned
rows.  It's doable but not simple.  Moreover, it's far from clear this
actually would save much, and it could easily slow things down at
execution time.

Have you done any profiling work to see where the extra time goes?
I had thought that the unreferenced RTE entries would simply be ignored
in each subplanning step, but maybe there's something that is examining
them.

            regards, tom lane

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Group commit and commit delay/siblings
Next
From: Robert Haas
Date:
Subject: Re: Performance under contention