Re: ON CONFLICT DO UPDATE for partitioned tables
От | Amit Langote |
---|---|
Тема | Re: ON CONFLICT DO UPDATE for partitioned tables |
Дата | |
Msg-id | 825031be-942c-8c24-6163-13c27f217a3d@lab.ntt.co.jp обсуждение исходный текст |
Ответ на | Re: ON CONFLICT DO UPDATE for partitioned tables (Alvaro Herrera <alvherre@alvh.no-ip.org>) |
Ответы |
Re: ON CONFLICT DO UPDATE for partitioned tables
Re: ON CONFLICT DO UPDATE for partitioned tables |
Список | pgsql-hackers |
On 2018/04/17 4:10, Alvaro Herrera wrote: > Amit Langote wrote: > >> The solution I came up with is to call map_variable_attnos() directly, >> instead of going through map_partition_varattnos() every time, after first >> creating the attribute map ourselves. > > Yeah, sounds good. I added a tweak: if the tupledescs are equal, there > should be no need to do any mapping. Thanks for the commit! About the equalTupleDescs()-based optimization you added -- It seems to me that that *always* returns false if you pass it tupledescs of two different tables, which in this case, we do. That's because equalTupleDescs has this: if (tupdesc1->tdtypeid != tupdesc2->tdtypeid) return false; So, it fails to optimize as you were hoping it would. Instead of doing this, I think we should try to make convert_tuples_by_name_map() a bit smarter by integrating the logic in convert_tuples_by_name() that's used conclude if no tuple conversion is necessary. So, if it turns that the tuples descriptors passed to convert_tuples_by_name_map() contain the same number of attributes and the individual attributes are at the same positions, we signal to the caller that no conversion is necessary by returning NULL. Attached find a patch that does that. When working on this, I noticed that when recursing for inheritance children, ATPrepAlterColumnType() would use a AlterTableCmd (cmd) that's already scribbled on as if it were the original. Thanks, Amit
Вложения
В списке pgsql-hackers по дате отправления: