From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ken Tanzer <ken.tanzer@gmail.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: Speeding up query pulling comments from pg_catalog
Date: Sat, 20 Jul 2019 15:25:03 -0400
Message-ID: <11474.1563650703@sss.pgh.pa.us> (raw)
In-Reply-To: <CAD3a31U5Kb48p32AbiaZqMa-Rg1R3f7JvZY1Vgkx4Y31XqigRg@mail.gmail.com>
References: <CAD3a31UEEojeQ9VYZHO0u2j0eyyh5jaYd8Pc=7yfJEHrfzELFg@mail.gmail.com>
<19788.1563634004@sss.pgh.pa.us>
<CAD3a31U5Kb48p32AbiaZqMa-Rg1R3f7JvZY1Vgkx4Y31XqigRg@mail.gmail.com>
Ken Tanzer <ken.tanzer@gmail.com> writes:
> On Sat, Jul 20, 2019 at 7:46 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> and then to add insult to injury, has to search pg_description a second
>> time for each hit.
> Not sure if I'm understanding this correctly, but are you saying that
> because col_description() is specified in two places in the query, that it
> actually will get called twice?
Yes.
> I was under the impression that a function
> (at least a non-volatile one) specified multiple times, but with the same
> arguments, would only get called once. Is that just wishful thinking?
Afraid so. There's been assorted talk about various optimizations to
avoid unnecessary duplicate function calls, but I don't think that
merging textually-separate calls has even been on the radar. The
discussions I can recall have been more about not calling stable functions
(with fixed arguments) more than once per query.
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, ken.tanzer@gmail.com, pgsql-performance@lists.postgresql.org
Subject: Re: Speeding up query pulling comments from pg_catalog
In-Reply-To: <11474.1563650703@sss.pgh.pa.us>
* 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