public inbox for [email protected]  
help / color / mirror / Atom feed
From: Richard Guo <[email protected]>
To: Tom Lane <[email protected]>
Cc: David Rowley <[email protected]>
Cc: Andrew Dunstan <[email protected]>
Cc: jian he <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Revert: Remove useless self-joins *and* -DREALLOCATE_BITMAPSETS make server crash, regress test fail.
Date: Thu, 9 May 2024 10:43:31 +0800
Message-ID: <CAMbWs49fy=f-jCd7s33d9AGjnYZn6R8TEDU6armi7Yo6QHCKiw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CACJufxFVQmr4=JWHAOSLuKA5Zy9H26nY6tVrRFBOekHoALyCkQ@mail.gmail.com>
	<CAApHDvpBMSGhXVeFdw_qmjPqU5yHvJJ7k0z7kD069EC4di2Pag@mail.gmail.com>
	<CAMbWs4-iYKxrMs8kj+49gVA4X1_=PYAaw5HL_3g_yVXpAHzYww@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAApHDvoR9cXHb_+j7j8=zBty35B8z22SX51cZN7ZRf+QTPJ1fA@mail.gmail.com>
	<[email protected]>
	<CAApHDvrvcJd2DCAV0vDKmRxp5tvXq3=+RwhRns4OjoHQ1UbDEg@mail.gmail.com>
	<[email protected]>
	<CAApHDvqRgYq8yL3GUj-1z2xPv6cLy7D4tjxhhijWnsHLOSukLg@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAApHDvp5Az4MA3r1REaV=NyTF=30qNhe+N=OWb5g_edAvS+rCA@mail.gmail.com>
	<[email protected]>

On Thu, May 9, 2024 at 6:40 AM Tom Lane <[email protected]> wrote:

> David Rowley <[email protected]> writes:
> > I'm fine with this one as it's the same as what I already mentioned
> > earlier.  I had imagined doing bms_del_member(bms_copy ... but maybe
> > the compiler is able to optimise away the additional store. Likely, it
> > does not matter much as pallocing memory likely adds far more overhead
> > anyway.
>
> I actually wrote it that way to start with, but undid it after
> noticing that the existing code in remove_rel_from_restrictinfo
> does it in separate steps, and thinking that that was good for
> both separation of concerns and a cleaner git history.  I too
> can't believe that an extra fetch will be noticeable compared
> to the cost of the adjacent bms_xxx operations.


I also think it seems better to do bms_copy in separate steps, not only
because this keeps consistent with the existing code in
remove_rel_from_restrictinfo, but also because we need to do
bms_del_member twice for each lefthand/righthand relid set.

Speaking of consistency, do you think it would improve the code's
readability if we rearrange the code in remove_rel_from_query so that
the modifications of the same relid set are grouped together, just like
what we do in remove_rel_from_restrictinfo?  I mean something like:

   sjinf->min_lefthand = bms_copy(sjinf->min_lefthand);
   sjinf->min_lefthand = bms_del_member(sjinf->min_lefthand, relid);
   sjinf->min_lefthand = bms_del_member(sjinf->min_lefthand, ojrelid);

   ...

Thanks
Richard


view thread (14+ messages)  latest in thread

reply

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Revert: Remove useless self-joins *and* -DREALLOCATE_BITMAPSETS make server crash, regress test fail.
  In-Reply-To: <CAMbWs49fy=f-jCd7s33d9AGjnYZn6R8TEDU6armi7Yo6QHCKiw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox