Re: Query much slower when run from postgres function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Query much slower when run from postgres function
Дата
Msg-id 14317.1236628318@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Query much slower when run from postgres function  (Mario Splivalo <mario.splivalo@megafon.hr>)
Ответы Re: Query much slower when run from postgres function
Список pgsql-performance
Mario Splivalo <mario.splivalo@megafon.hr> writes:
> Is this difference normal?

It's hard to tell, because you aren't comparing apples to apples.
Try a prepared statement, like

prepare foo(int) as
SELECT
    COUNT(*)::int4
FROM
    _v1
WHERE
    service_id = $1
;

execute foo(504);

which should produce results similar to the function.  You could
then use "explain analyze execute" to probe further into what's
happening.

            regards, tom lane

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

Предыдущее
От: Mario Splivalo
Дата:
Сообщение: Re: Query much slower when run from postgres function
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: [JDBC] Query much slower when run from postgres function