From: Jinyu Zhang <beijing_pg@163.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Patch: Optimize memory allocation in function 'bringetbitmap'
Date: Sat, 17 Oct 2015 02:00:13 +0800 (CST)
Message-ID: <2ea866d6.5fd.15071cf2a8e.Coremail.beijing_pg@163.com> (raw)
In-Reply-To: <20151016021334.GA3391@alvherre.pgsql>
References: <495deb78.4186.1500dacaa63.Coremail.beijing_pg@163.com>
<20150927175608.GM295765@alvherre.pgsql>
<1443451254826-5867647.post@n5.nabble.com>
<20151016021334.GA3391@alvherre.pgsql>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Update the patch_brin_optimze_mem according to your comment.
At 2015-10-16 10:13:35, "Alvaro Herrera" <alvherre@2ndquadrant.com> wrote:
>zhangjinyu wrote:
>
>> >>>>However I wonder if it would be simpler to have the dtup structure have
>> >>>>the pointers, so that you can pass it as NULL in the first call and then
>> >>>>followup calls reuse the one allocated in the first call.
>> Jinyu: the memory is allocated from perRangeCxt and perRangeCxt will be
>> reset in loop,
>> so this way don't work.
>
>You're right. I think we can do better: have brin_deform_tuple accept
>another argument of type BrinMemTuple *, which can be NULL. If NULL,
>the function calls brin_new_memtuple to allocate a new one (just like
>current code); if not NULL, that one is used. Have brin_new_memtuple
>also allocate the values/allnulls/hasnulls arrays, which are now part of
>the BrinMemTuple struct. Then, bringetbitmap calls brin_new_memtuple
>once before changing to perRangeCxt, then reuse the returned inside the
>loop (we probably need brin_memtuple_initialize to clear out the struct
>at the end of each loop iteration). Other callers of brin_deform_tuple
>just pass NULL to get the current behavior.
>
>--
>Álvaro Herrera http://www.2ndQuadrant.com/
>PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>
>
>--
>Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
>To make changes to your subscription:
>http://www.postgresql.org/mailpref/pgsql-hackers
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackersAttachments:
[application/octet-stream] patch_brin_optimize_mem (6.6K, ../2ea866d6.5fd.15071cf2a8e.Coremail.beijing_pg@163.com/3-patch_brin_optimize_mem)
download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: beijing_pg@163.com, alvherre@2ndquadrant.com
Subject: Re: Patch: Optimize memory allocation in function 'bringetbitmap'
In-Reply-To: <2ea866d6.5fd.15071cf2a8e.Coremail.beijing_pg@163.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox