Use opresulttype instead of calling SearchSysCache1() in match_orclause_to_indexcol()

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Use opresulttype instead of calling SearchSysCache1() in match_orclause_to_indexcol()
Date: 2025-09-19 11:44:56
Message-ID: CAHewXN=aH7GQBk4fXU-WaEeVmQWUmBAeNyBfJ3VKzPphyPKUkQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

While working on another issue, I stepped into match_orclause_to_indexcol().
I found below codes:

/* Only the operator returning a boolean suit the transformation. */
if (get_op_rettype(opno) != BOOLOID)
break;

In get_op_rettype, it calls SearchSysCache1() to get oprresult
of Form_pg_operator.
I think we can use the opresulttype of OpExpr to achieve the same effect,
but there is no need to call SearchSysCache1().

Although this would not improve performance, it can save some CPU time.
Any thoughts?

--
Thanks,
Tender Wang

Attachment Content-Type Size
0001-Use-opresulttype-to-check-instead-of-calling-SearchS.patch application/octet-stream 1012 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tender Wang 2025-09-19 11:46:05 Re: Fix typo in comment of match_orclause_to_indexcol()
Previous Message David Rowley 2025-09-19 11:42:07 Re: Having postgresql.org link to cgit instead of gitweb