Re: SQL functions not being inlined

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SQL functions not being inlined
Дата
Msg-id 28134.1335930256@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SQL functions not being inlined  (Evan Martin <postgresql@realityexists.net>)
Ответы Re: SQL functions not being inlined  (Evan Martin <postgresql@realityexists.net>)
Список pgsql-general
Evan Martin <postgresql@realityexists.net> writes:
> 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. ...
> This is quite slow, especially when I have a WHERE clause that narrows
> down the set of rows from 100,000 to 10 or so. I suspect it's evaluating
> the function first and filtering it afterwards and perhaps not using the
> index, either.

Well, rather than suspecting, you should use EXPLAIN to find out whether
the functions are inlined or not.  The particular example you give here
seems inlinable to me, but maybe some of your other cases aren't.

I concur with the other respondent that OVERLAPS is not the most
efficient way to deal with the sort of condition you have here, either.
Postgres basically doesn't know how to optimize OVERLAPS at all, whereas
the planner has heard of BETWEEN and other simple-comparison constructs.

            regards, tom lane

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

Предыдущее
От: Chris Angelico
Дата:
Сообщение: Re: SQL functions not being inlined
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: installation of plpython2.7