OOM-killer issue when updating a inheritance table which has large number of child tables
От | chenhj |
---|---|
Тема | OOM-killer issue when updating a inheritance table which has large number of child tables |
Дата | |
Msg-id | 8c9acaa.1f453.14c0da0402f.Coremail.chjischj@163.com обсуждение исходный текст |
Ответы |
Re: OOM-killer issue when updating a inheritance table
which has large number of child tables
Re: OOM-killer issue when updating a inheritance table which has large number of child tables |
Список | pgsql-hackers |
Hi
In my test(PG9.3.4), i found when update a parent table which has a large number of child tables, the execute plan will consume lots of memory. And possibly cause OOM.
For example:
create table maintb(id int,name char(10));
create table childtb_1 (CHECK ( id BETWEEN 1 AND 200)) inherits(maintb);
create table childtb_2 (CHECK ( id BETWEEN 201 AND 400)) inherits(maintb);
...
create table childtb_n ...
When there are 100 child tables,the following update statement will consume about 8MB memory when invoking pg_plan_queries()
update maintb set name = 'aaaaa12345' where id=1;
And, when there are 1000 child tables,the same update statement will consume 717MB memory when invoking pg_plan_queries().
Does this a known problem, and could that be improved in the future?
BTW:
The following comment is according my debuging when update the parent table with 1000 child tables
src/backend/optimizer/plan/planner.c
static Plan *
inheritance_planner(PlannerInfo *root)
{
...
foreach(lc, root->append_rel_list)//### loop 1001 time
{
...
subroot.parse = (Query *)
adjust_appendrel_attrs(root,
(Node *) parse,
appinfo);//### allocate about 300KB memory a time.
...
subroot.append_rel_list = (List *) copyObject(root->append_rel_list);//### allocate about 400KB memory a time.
...
}
...
}
Best Regards
Chen Huajun
В списке pgsql-hackers по дате отправления: