Re: Improve cache hit rate for OprCacheHash

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: myzhen <zhenmingyang(at)yeah(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improve cache hit rate for OprCacheHash
Date: 2025-08-22 12:18:06
Message-ID: 19d1070b-64ca-4432-8ed3-2d6d2203c382@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mihail Nikalayeu 2025-08-22 12:47:57 Re: [BUG?] check_exclusion_or_unique_constraint false negative
Previous Message Heikki Linnakangas 2025-08-22 11:56:35 Re: BackendKeyData is mandatory?