Re: Speeding up query pulling comments from pg_catalog

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Speeding up query pulling comments from pg_catalog
Date: 2019-07-20 19:25:03
Message-ID: 11474.1563650703@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com> writes:
> On Sat, Jul 20, 2019 at 7:46 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Fabio Pardi 2019-07-22 06:41:59 benchmarking effective_io_concurrency
Previous Message Ken Tanzer 2019-07-20 19:08:00 Re: Speeding up query pulling comments from pg_catalog