Re: Optimize planner memory consumption for huge arrays
Dilip Kumar <dilipbalaut@gmail.com>
From: Dilip Kumar <dilipbalaut@gmail.com>
To: Lepikhov Andrei <a.lepikhov@postgrespro.ru>
Cc: pgsql-hackers@lists.postgresql.org, Евгений Бредня <e.brednya@postgrespro.ru>
Date: 2023-09-04T10:59:01Z
Lists: pgsql-hackers
On Mon, Sep 4, 2023 at 3:49 PM Lepikhov Andrei <a.lepikhov@postgrespro.ru> wrote: > > > + Const *c = makeConst(nominal_element_type, > > + -1, > > + nominal_element_collation, > > + elmlen, > > + elem_values[i], > > + elem_nulls[i], > > + elmbyval); > > + > > + args = list_make2(leftop, c); > > if (is_join_clause) > > s2 = DatumGetFloat8(FunctionCall5Coll(&oprselproc, > > clause->inputcollid, > > @@ -1984,7 +1985,8 @@ scalararraysel(PlannerInfo *root, > > ObjectIdGetDatum(operator), > > PointerGetDatum(args), > > Int32GetDatum(varRelid))); > > - > > + list_free(args); > > + pfree(c); > > > > Maybe you can just use list_free_deep, instead of storing the constant > > in a separate variable. > As I see, the first element in the array is leftop, which is used on other iterations. So, we can't use list_free_deep here. Yeah you are right, thanks. -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com