Re: Speeding up query pulling comments from pg_catalog

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Speeding up query pulling comments from pg_catalog
Дата
Msg-id 28922.1563825438@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Speeding up query pulling comments from pg_catalog  (Ken Tanzer <ken.tanzer@gmail.com>)
Список pgsql-performance
Ken Tanzer <ken.tanzer@gmail.com> writes:
> On Sat, Jul 20, 2019 at 12:25 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> There's been assorted talk about various optimizations to
>> avoid unnecessary duplicate function calls,

> So I had read the sentence below to mean my functions would only get called
> once.  But is that sentence only supposed to apply to index scans?  Or does
> it mean the planner is allowed to optimize, but it just doesn't know how
> yet?

> A STABLE function cannot modify the database and is guaranteed to return
> the same results given the same arguments for all rows within a single
> statement. *This category allows the optimizer to optimize multiple calls
> of the function to a single call.*

It says "allows", not "requires".  But in particular, we've interpreted
that to mean trying to call a stable function (with constant or at least
stable arguments) once per query rather than once per row, as the naive
interpretation of SQL semantics would have us do.  Matching up textually
distinct calls has not been on the radar --- it seems fairly expensive
to do, with no return in typical queries, and relatively small return
even if we find a match.

            regards, tom lane



В списке pgsql-performance по дате отправления:

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: benchmarking effective_io_concurrency
Следующее
От: Kristian Ejvind
Дата:
Сообщение: zabbix on postgresql - very slow delete of events