[HACKERS] 0/NULL/NIL assignments in build_*_rel() - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject [HACKERS] 0/NULL/NIL assignments in build_*_rel()
Date
Msg-id CAFjFpRcnVDb1ukbuCJYWRTvMJ_c+mRj0w-5oPTbi5dPBmCg-yQ@mail.gmail.com
Whole thread Raw
Responses Re: [HACKERS] 0/NULL/NIL assignments in build_*_rel()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,
Both build_simple_rel() and build_join_rel() allocate RelOptInfo using
makeNode(), which returned a zeroed out memory. The functions then
assign values like false, NULL, 0 or NIL which essentially contain
zero valued bytes. This looks like needless work. So, we are spending
some CPU cycles unnecessarily in those assignments. That may not be
much time wasted, but whenever someone adds a field to RelOptInfo,
those functions need to be updated with possibly a zero value
assignment. That looks like an unnecessary maintenance burden. Should
we just drop all those zero value assignments from there? If there's
any reason to have those assignments there, should we move the code to
allocate RelOptInfo and assign zero values to a separate function and
call it from those two functions? fetch_upper_rel() also has those
kinds of assignments, but they are far fewer than build_*_rel().

-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company



pgsql-hackers by date:

Previous
From: Kouhei Kaigai
Date:
Subject: Re: ParallelFinish-hook of FDW/CSP (Re: [HACKERS] Steps insideExecEndGather)
Next
From: Michael Paquier
Date:
Subject: Re: [HACKERS] Provide list of subscriptions and publications inpsql's completion