Re: speeding up planning with partitions

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: speeding up planning with partitions
Дата
Msg-id CAKJS1f9LkQ=w4cq2_OaW05=mw8H_jQofWHiK0w3VVP-nSkUUmA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: speeding up planning with partitions  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Ответы Re: speeding up planning with partitions  (Amit Langote <amitlangote09@gmail.com>)
Список pgsql-hackers
On Fri, 1 Feb 2019 at 23:01, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> Please rebase.

I had a short list of other things I noticed when making a partial
pass over the patch again.

I may as well send these now if there's a new version on the way:

1. I think it's okay to convert the following:

/*
* Adjust all_baserels to replace the original target relation with the
* child target relation.  Copy it before modifying though.
*/
subroot->all_baserels = bms_copy(root->all_baserels);
subroot->all_baserels = bms_del_member(subroot->all_baserels,
   root->parse->resultRelation);
subroot->all_baserels = bms_add_member(subroot->all_baserels,
   subroot->parse->resultRelation);

into:
/* Adjust all_baserels */
subroot->all_baserels = adjust_child_relids(root->all_baserels, 1, &appinfo);


2. Any reason to do:

/*
* Generate access paths for the entire join tree.
*
* For UPDATE/DELETE on an inheritance parent, join paths should be
* generated for each child result rel separately.
*/
if (root->parse->resultRelation &&
root->simple_rte_array[root->parse->resultRelation]->inh)

instead of just checking: if (root->inherited_update)

3. This seems like useless code in set_inherit_target_rel_sizes().

/*
* If parallelism is allowable for this query in general, see whether
* it's allowable for this childrel in particular.  For consistency,
* do this before calling set_rel_size() for the child.
*/
if (root->glob->parallelModeOK)
set_rel_consider_parallel(subroot, childrel, childRTE);


parallelModeOK is only ever set for SELECT.  Likely it's fine just to
replace these with:

+               /* We don't consider parallel paths for UPDATE/DELETE
statements */
+               childrel->consider_parallel = false;

or perhaps it's fine to leave it out since build_simple_rel() sets it to false.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: speeding up planning with partitions
Следующее
От: David Rowley
Дата:
Сообщение: Re: Delay locking partitions during INSERT and UPDATE