Re:Re: Improve cache hit rate for OprCacheHash

From: myzhen <zhenmingyang(at)yeah(dot)net>
To: "Heikki Linnakangas" <hlinnaka(at)iki(dot)fi>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re:Re: Improve cache hit rate for OprCacheHash
Date: 2025-08-22 14:08:52
Message-ID: 164ccba8.1d24.198d21c63a1.Coremail.zhenmingyang@yeah.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for your reply,If multiple exact matches are found, it selects the first schema in activeSearchPath as the result. Therefore, the order of search_path is indeed meaningful.

At 2025-08-22 20:18:06, "Heikki Linnakangas" <hlinnaka(at)iki(dot)fi> wrote:
>On 22/08/2025 14:15, myzhen wrote:
>> The order of all schemas in OprCacheKey.search_path should be
>> meaningless.
>
>No, operators live in schemas, just like tables and functions. To
>demonstrate:
>
>create schema schema1;
>create schema schema2;
>
>create function schema1.plus(int, int) RETURNS int AS $$ SELECT $1 + $1
>$$ LANGUAGE SQL;
>create function schema2.minus(int, int) RETURNS int AS $$ SELECT $1 - $1
>$$ LANGUAGE SQL;
>
>CREATE OPERATOR schema1(dot)(at)+-@ (LEFTARG = int, RIGHTARG = int, FUNCTION=plus);
>CREATE OPERATOR schema2(dot)(at)+-@ (LEFTARG = int, RIGHTARG = int,
>FUNCTION=minus);
>
>postgres=# set search_path=schema1,schema2;
>SET
>postgres=# select 1 @+-@ 1;
> ?column?
>----------
> 2
>(1 row)
>
>postgres=# set search_path=schema2,schema1;
>SET
>postgres=# select 1 @+-@ 1;
> ?column?
>----------
> 0
>(1 row)
>
>- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-08-22 14:10:54 Re: Add OID descriptions to dumped parse/query/plan trees
Previous Message Nathan Bossart 2025-08-22 14:05:56 Re: Don't treat virtual generated columns as missing statistics in vacuumdb --missing-stats-only