Re: SQL functions not being inlined

Поиск
Список
Период
Сортировка
От Chris Angelico
Тема Re: SQL functions not being inlined
Дата
Msg-id CAPTjJmpowjy+Ghcq-Km3Xeer+fmW1F-Cwz3DObc2WHTg=bgH0g@mail.gmail.com
обсуждение исходный текст
Ответ на SQL functions not being inlined  (Evan Martin <postgresql@realityexists.net>)
Список pgsql-general
On Wed, May 2, 2012 at 12:43 PM, Evan Martin
<postgresql@realityexists.net> wrote:
> Some of my functions are running much slower than doing the same query
> "inline" and I'd like to know if there's a way to fix that.
> [chomp analysis and examples]

Is there any possibility that you could recode your functions as
views? The optimizer can push predicates down into views but not, it
would appear, into functions.

In the specific example given, I would be looking, not for an
OVERLAPS, but a simple comparison:

SELECT * FROM thing_timeslice
WHERE '2012-05-01' BETWEEN valid_time_begin AND
COALESCE(valid_time_end, 'infinity'::timestamp)

That may make it easier for the optimizer.

ChrisA

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

Предыдущее
От: Evan Martin
Дата:
Сообщение: SQL functions not being inlined
Следующее
От: Tom Lane
Дата:
Сообщение: Re: SQL functions not being inlined