pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Save a few bytes by removing useless last argument to SearchCatC
Date: Mon, 29 Jan 2018 20:13:30 +0000
Message-ID: <E1egFo2-0005vv-7b@gemulon.postgresql.org> (raw)

Save a few bytes by removing useless last argument to SearchCatCacheList.

There's never any value in giving a fully specified cache key to
SearchCatCacheList: you might as well call SearchCatCache instead,
since there could be only one match.  So the maximum useful number of
key arguments is one less than the supported number of key columns.
We might as well remove the useless extra argument and save some few
bytes per call site, as well as a cycle or so per call.

I believe the reason it was coded like this is that originally, callers
had to write out all the dummy arguments in each call, and so it seemed
less confusing if SearchCatCache and SearchCatCacheList took the same
number of key arguments.  But since commit e26c539e9, callers only write
their live arguments explicitly, making that a non-factor; and there's
surely been enough time for third-party modules to adapt to that coding
style.  So this is only an ABI break not an API break for callers.

Per discussion with Oliver Ford, this might also make it less confusing
how to use SearchCatCacheList correctly.

Discussion: https://postgr.es/m/27788.1517069693@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/97d4445a033f1cc02784d42561b52b3441c8eddd

Modified Files
--------------
src/backend/utils/cache/catcache.c |  9 +++++++--
src/backend/utils/cache/syscache.c |  4 ++--
src/include/utils/catcache.h       |  2 +-
src/include/utils/syscache.h       | 10 ++++------
4 files changed, 14 insertions(+), 11 deletions(-)



Message-ID: <E1egFo2-0005vv-7b@gemulon.postgresql.org>
Permalink:  ../E1egFo2-0005vv-7b@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1egFo2-0005vv-7b@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Save a few bytes by removing useless last argument to SearchCatC
  In-Reply-To: <E1egFo2-0005vv-7b@gemulon.postgresql.org>
  References: <E1egFo2-0005vv-7b@gemulon.postgresql.org>

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

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