Re: plpgsql functions vs. embedded queries

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: plpgsql functions vs. embedded queries
Дата
Msg-id 25540.1222729631@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: plpgsql functions vs. embedded queries  ("Wright, George" <George.Wright@infimatic.com>)
Ответы Re: plpgsql functions vs. embedded queries  ("Wright, George" <George.Wright@infimatic.com>)
Список pgsql-novice
"Wright, George" <George.Wright@infimatic.com> writes:
>> Are funtions in plpgsql always slower than embedding sql queries in
>> string form in code like PHP?
> The functions took on average more than 10 times as long.

That suggests that you're getting a radically different, less efficient
plan for the "same" query inside a function.  The exact reasons why are
hard to diagnose without a concrete example, but usually the story has
to do with comparing parameterized queries inside a function to
not-parameterized queries elsewhere.  There are various workarounds
but the best choice depends on details you've not shown us.

            regards, tom lane

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

Предыдущее
От: "Wright, George"
Дата:
Сообщение: Re: plpgsql functions vs. embedded queries
Следующее
От: "Shabala Deshpande"
Дата:
Сообщение: !!! Compress individual tables with postgres