Re: Query is slow when executing in procedure

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Query is slow when executing in procedure
Дата
Msg-id 162867790911232210u111b1609i1252dd14e44e4e07@mail.gmail.com
обсуждение исходный текст
Ответ на Query is slow when executing in procedure  ("ramasubramanian" <ramasubramanian.g@renaissance-it.com>)
Список pgsql-performance
2009/11/24 ramasubramanian <ramasubramanian.g@renaissance-it.com>:
> Dear all,
>     The query is slow when executing in the stored procedure(it is taking
> around 1 minute). when executing as a sql it is taking 4 seconds.
> basically i am selecting the varchar column which contain 4000 character. We
> have as iindex on the table. We have analyzed the table also. What could be
> the reason. How to improve it?

Hello

use a dynamic query - plpgsql uses prepared statements. It use plans
generated without knowledge of real params. Sometime it should to do
performance problem. EXECUTE statement (in plpgsql) uses new plan for
every call (and generated with knowledge of real params) - so it is a
solution for you.

http://www.postgresql.org/docs/8.4/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

Regards
Pavel Stehule



>
> Thanks in Advance
> Ram

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

Предыдущее
От: "ramasubramanian"
Дата:
Сообщение: Query is slow when executing in procedure
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Query is slow when executing in procedure