rename es_epq_active to es_epqstate

From: Junwang Zhao <zhjwpku(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: rename es_epq_active to es_epqstate
Date: 2025-01-18 01:23:19
Message-ID: CAEG8a3+X6f6Qr9C60ymsB99jtPm=GfV2oAPrE_6WM9=KrpRKKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

While reviewing the ExecSeqScan optimizations patch[1], I found that
es_epq_active might not be well named, my intuition told me that this
is a boolean field because of the "active" suffix.

es_epq_active was introduced in 27cc7cd, in the original discussion[2],
Tom and Andres discussed the field name "es_active_epq" a little bit,
let me quote some:

------- quoted content begin
> Also I dislike the field name "es_active_epq", as what that suggests
> to me is exactly backwards from the way you apparently are using it.
> Maybe "es_parent_epq" instead? The comment for it is pretty opaque
> as well, not to mention that it misspells EState.

I think what I was trying to signal was that EPQ is currently active
from the POV of executor nodes. Ought to have been es_epq_active, for
that, I guess. For me "if (estate->es_epq_active)" explains the meaning
of the check more than "if (estate->es_parent_epq)".

I went with es_epq_active, as I suggested in my earlier email, which
still seems accurate to me.

I really want to move consideration of es_ep_active to ExecInitNode()
time, rather than execution time. If we add an execScan helper, we can
have it set the corresponding executor node's ExecProcNode to
a) a function that performs qual checks and projection
b) a function that performs projection
c) the fetch method from the scan node
d) basically the current ExecScan, when es_epq_active
-------- quoted content end

ISTM Andres tend to use *es_epq_active* in a boolean way,
like `if (es_epq_active) then`, but in the code base, all its usages
follow pattern `if (es_epq_active == NULL) then`, so I propose to
change es_epq_active to es_epqstate.

[1] https://www.postgresql.org/message-id/CA%2BHiwqF%2BoydVreYN3Xp7U6x_LKi9ZL%2BNo2X6WUv8X_kN%2ByHSLA%40mail.gmail.com
[2] https://www.postgresql.org/message-id/20190828030201.v5u76ty47mtw2efp%40alap3.anarazel.de

--
Regards
Junwang Zhao

Attachment Content-Type Size
v1-0001-rename-es_epq_active-to-es_epqstate.patch application/octet-stream 8.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-01-18 01:43:32 Re: rename es_epq_active to es_epqstate
Previous Message Masahiko Sawada 2025-01-18 01:11:41 Re: pg_trgm comparison bug on cross-architecture replication due to different char implementation